EZStorage

An asset by mashumafi
The page banner background of a mountain and forest
EZStorage hero image

Quick Information

0 ratings
EZStorage icon image
mashumafi
EZStorage

Easily store/fetch data using key-value storage.EZStorage* A low-level key-value storage using the file system.* Store/Fetch anything that would work with var2str.* Replication logic can prevent corrupted files.EZCache* An efficient in-memory cache that only loads files once.* Includes events for receiving updates when values change.

Supported Engine Version
3.4
Version String
0.0.1
License Version
MIT
Support Level
community
Modified Date
2 years ago
Git URL
Issue URL

EZStorage

Easily store/fetch data using key-value storage.

  • EZStorage
    • A low-level key-value storage using the file system.
    • Store/Fetch anything that would work with var2str.
    • Replication logic can prevent corrupted files.
  • EZCache
    • An efficient in-memory cache that only loads files once.
    • Includes events for receiving updates when values change.

Settings

Settings can be found under application/storage in the project settings.

Directory

The directory used to save the data. It should be at least in user:// and by default is user://data.

Debug Filenames

When enabled file names will use html encoding making it easier to debug the files created. This feature can be disabled to use filenames that would be used in release mode.

API

EZStorage API

A low-level key-value storage using the file system.

# Store a value.
EZStorage.store("my_section", "my_key", "my_value")


# Fetch a value, return null if key does not exist.
EZStorage.fetch("my_section", "my_key")

# Fetch a value, return "my_default" if key does not exist
EZStorage.fetch("my_section", "my_key", "my_default")


# Delete all data in "my_section/my_key".
EZStorage.purge("my_section", "my_key")

# Delete all data in "my_section".
EZStorage.purge("my_section")

# Delete all data.
EZStorage.purge()

EZCache API

An efficient in-memory cache that only loads from storage once.

# Create a cache.
var my_section = EZCache.get_section("my_section")


# Store a key in the cache.
my_section.store("my_key", "my_value")


# Fetch a value, return null if key does not exist.
var my_value = my_section.fetch("my_key")

# Fetch a value, return "my_default" if key does not exist.
var my_value = my_section.fetch("my_key", "my_default")

# Fetch a value, return "my_default" if key does not exist. Will set "my_default" in the cache for future fetching.
var my_value = my_section.fetch("my_key", "my_default", true)]


# Delete all keys in my_section except those listed
my_section.purge(["skipped_key"])

# Delete all sections in cache except those listed
EZCache.purge(["skipped_section"])


# Yield until a key is changed on the cache
var key = yield(my_cache, "changed")
print("The following key changed in my_section: ", key)

# Connect method and listen to key change events
function _key_changed(key: String) -> void:
  print("The following key changed in my_section: ", key)
my_section.connect("changed, self, "_key_changed")

Easily store/fetch data using key-value storage.

EZStorage
* A low-level key-value storage using the file system.
* Store/Fetch anything that would work with var2str.
* Replication logic can prevent corrupted files.
EZCache
* An efficient in-memory cache that only loads files once.
* Includes events for receiving updates when values change.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
EZStorage icon image
mashumafi
EZStorage

Easily store/fetch data using key-value storage.EZStorage* A low-level key-value storage using the file system.* Store/Fetch anything that would work with var2str.* Replication logic can prevent corrupted files.EZCache* An efficient in-memory cache that only loads files once.* Includes events for receiving updates when values change.

Supported Engine Version
3.4
Version String
0.0.1
License Version
MIT
Support Level
community
Modified Date
2 years ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers