OpenMod Docs OpenMod Docs
OpenMod Docs OpenMod Docs
OpenMod .NET Plugin Framework.

Interface IDataStore

Provides persistent storage.

Namespace: OpenMod.API.Persistence
Assembly: OpenMod.API.dll
Syntax
public interface IDataStore

Methods

| Improve this Doc View Source

AddChangeWatcher(String, IOpenModComponent, Action)

Adds a change watcher if the data has changed externally. Does not trigger for calls to SaveAsync<T>(String, T).

Declaration
IDisposable AddChangeWatcher(string key, IOpenModComponent component, Action onChange)
Parameters
Type Name Description
System.String key

The key to listen to.

IOpenModComponent component

The component registering the change watcher.

Action onChange

The on change callback.

Returns
Type Description
IDisposable

An that will unregister the change watcher on disposal.

| Improve this Doc View Source

ExistsAsync(String)

Checks if the give key exists.

Declaration
Task<bool> ExistsAsync(string key)
Parameters
Type Name Description
System.String key

The key to check.

Returns
Type Description
Task<System.Boolean>
| Improve this Doc View Source

LoadAsync<T>(String)

Loads data from the given key.

Declaration
Task<T> LoadAsync<T>(string key)
    where T : class
Parameters
Type Name Description
System.String key

The key to load from.

Returns
Type Description
Task<T>
Type Parameters
Name Description
T
| Improve this Doc View Source

SaveAsync<T>(String, T)

Saves data with given key.

Declaration
Task SaveAsync<T>(string key, T data)
    where T : class
Parameters
Type Name Description
System.String key

The key to store to.

T data

The data to store to.

Returns
Type Description
Task
Type Parameters
Name Description
T

Extension Methods

DisposeHelper.DisposeSyncOrAsync(Object)