logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Interface IKeyValueStore

    Interface for a key-value persistence store that supports byte-oriented get and set operations.

    Inherited Members
    IKeyedStore.ExistsAsync(string, CancellationToken)
    IKeyedStore.DeleteAsync(string, CancellationToken)
    IPersistenceStore.HealthCheckAsync(CancellationToken)
    IPersistenceStore.Namespace
    Namespace: Serenity.Persistence.Domain.Interfaces
    Assembly: Serenity.Global.Domain.dll
    Syntax
    public interface IKeyValueStore : IKeyedStore, IPersistenceStore
    Remarks

    Provides a lightweight alternative to IBlobStore for scenarios where stream-based I/O is unnecessary. Suitable for simple key-value backends such as PlayerPrefs.

    Methods

    GetAsync(string, CancellationToken)

    Gets the byte content associated with the specified key.

    Declaration
    Task<ReadOnlyMemory<byte>?> GetAsync(string key, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    string key

    The key to retrieve.

    CancellationToken cancellationToken

    A token to monitor for cancellation requests.

    Returns
    Type Description
    Task<ReadOnlyMemory<byte>?>

    A task that represents the asynchronous get operation, containing the byte content if the key exists, or null if not found.

    SetAsync(string, ReadOnlyMemory<byte>, CancellationToken)

    Sets the byte content for the specified key.

    Declaration
    Task SetAsync(string key, ReadOnlyMemory<byte> value, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    string key

    The key under which to store the content.

    ReadOnlyMemory<byte> value

    The byte content to store.

    CancellationToken cancellationToken

    A token to monitor for cancellation requests.

    Returns
    Type Description
    Task

    A task that represents the asynchronous set operation.

    In this article
    © 2026 Serenity. All Rights Reserved