logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class GatedKeyValueStore

    In-memory IKeyValueStore whose FIRST GetAsync call captures the current value and then suspends until the test calls ReleaseFirstReadGate() — returning the value it captured BEFORE suspending. This lets a test hold one read-modify-write cycle open on its stale snapshot while issuing a second concurrent operation, proving (or disproving) lost-update protection in the store under test.

    Inheritance
    object
    GatedKeyValueStore
    Implements
    IKeyValueStore
    IKeyedStore
    IPersistenceStore
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Tests.Shared.Fakes
    Assembly: Tests.dll
    Syntax
    public class GatedKeyValueStore : IKeyValueStore, IKeyedStore, IPersistenceStore

    Constructors

    GatedKeyValueStore()

    Declaration
    public GatedKeyValueStore()

    Properties

    Namespace

    Declaration
    public string Namespace { get; }
    Property Value
    Type Description
    string

    Methods

    DeleteAsync(string, CancellationToken)

    Declaration
    public Task DeleteAsync(string key, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    string key
    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    ExistsAsync(string, CancellationToken)

    Declaration
    public Task<bool> ExistsAsync(string key, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    string key
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<bool>

    GetAsync(string, CancellationToken)

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

    HealthCheckAsync(CancellationToken)

    Declaration
    public Task<bool> HealthCheckAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<bool>

    ReleaseFirstReadGate()

    Releases the suspended first read, letting its operation continue with the pre-captured value.

    Declaration
    public void ReleaseFirstReadGate()

    SetAsync(string, ReadOnlyMemory<byte>, CancellationToken)

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

    Implements

    IKeyValueStore
    IKeyedStore
    IPersistenceStore
    In this article
    © 2026 Serenity. All Rights Reserved