circle-info
Official release is coming soon

Cache

The moss sdk provides a simple persistent cache that it will be internally used for example the scheduler.

When using the cache a .cache folder will be created. Every item of the cache will be represented by it's own file named by its key. The default cache serializes all items as the cborarrow-up-right binary format. A class is cachable if it has an IShapable implementation. You can use the source generator of PolyTypearrow-up-right by annoating your class with [GenerateShape]

Working with the cache

The cache is accessible with MossExtension.Instance.Cache and has the following methods:

bool HasKey(string key)
void Set<T>(string key, T value) // the value has to be an IShapable<T>
T? Get<T>(string key)
void Remove(string key)

You can also implement your own cache by implementing the ICache interface.

Last updated

Was this helpful?