Show / Hide Table of Contents

    Interface IDataStoreService

    This service is meant to act as a simple key/value store. Using this service makes it easy to store information for other objects to look up. Depending on the implementation, this information could be serialized or not.

    dataStoreService.Set("foo", "bar"); dataStoreService.Get("foo") = "bar" dataStoreService.Get("foo", "default") = "bar" dataStoreService.Get("invalid", "default") = "default"

    Inherited Members
    IService.OnInitialized
    IService.IsInitialized
    IService.Initialize()
    IService.Cleanup()
    IInjectable.Inject(IResolver)
    Namespace: IdleKit.Core
    Assembly: cs.temp.dll.dll
    Syntax
    public interface IDataStoreService : IService, IInjectable

    Methods

    Clear()

    Clears all cached key/value pairs.

    Declaration
    void Clear()

    Get<TValue>(String, TValue)

    Returns the value for a key. If that key doesn't exist, returns a default value.

    Declaration
    TValue Get<TValue>(string key, TValue defaultValue)
    Parameters
    Type Name Description
    String key

    The key to look up the value for.

    TValue defaultValue

    The default value for this key.

    Returns
    Type Description
    TValue
    Type Parameters
    Name Description
    TValue

    The Type of the value.

    Get<TValue>(String, Func<TValue>)

    Returns the value for a key. If that key doesn't exist, calls a method to retrieve the default value.

    Declaration
    TValue Get<TValue>(string key, Func<TValue> defaultValueSelector)
    Parameters
    Type Name Description
    String key

    The key to look up the value for.

    Func<TValue> defaultValueSelector

    The method to use to generate a default value.

    Returns
    Type Description
    TValue
    Type Parameters
    Name Description
    TValue

    The Type of the value.

    Set<TValue>(String, TValue)

    Set the value for a key.

    Declaration
    void Set<TValue>(string key, TValue value)
    Parameters
    Type Name Description
    String key

    The key to cache the value under.

    TValue value

    The value to cache.

    Type Parameters
    Name Description
    TValue

    The Type of the value.

    Unset(String)

    Clears the cached value for a key.

    Declaration
    void Unset(string key)
    Parameters
    Type Name Description
    String key

    The key to clear.

    Back to top Copyright © 2020 East Side Games Inc.