logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class InMemoryLeaderboardStore

    In-memory ILeaderboardStore used for tests. Honors LeaderboardRetentionMode (raw storage keeps at most one entry per player for BestPerPlayer, or the full submission history for FullHistory) and MaxEntries trimming. Read operations follow the ILeaderboardStore read-operation contract: they rank over each player's best entry, regardless of retention mode — except GetTopAsync(BoardId, int, LeaderboardSortDirection, LeaderboardRankingMode, CancellationToken)'s AllEntries path, which returns every raw stored row instead.

    Inheritance
    object
    InMemoryLeaderboardStore
    Implements
    ILeaderboardStore
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Leaderboard.Tests.Fakes
    Assembly: Tests.dll
    Syntax
    public class InMemoryLeaderboardStore : ILeaderboardStore

    Constructors

    InMemoryLeaderboardStore()

    Declaration
    public InMemoryLeaderboardStore()

    Methods

    ClearAsync(BoardId, CancellationToken)

    Declaration
    public Task ClearAsync(BoardId board, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    BoardId board
    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    CountAsync(BoardId, CancellationToken)

    Declaration
    public Task<int> CountAsync(BoardId board, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    BoardId board
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<int>

    GetAroundAsync(BoardId, PlayerId, int, LeaderboardSortDirection, CancellationToken)

    Declaration
    public Task<IReadOnlyList<LeaderboardEntry>> GetAroundAsync(BoardId board, PlayerId player, int radius, LeaderboardSortDirection direction, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    BoardId board
    PlayerId player
    int radius
    LeaderboardSortDirection direction
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IReadOnlyList<LeaderboardEntry>>

    GetPlayerBestAsync(BoardId, PlayerId, CancellationToken)

    Declaration
    public Task<LeaderboardEntry?> GetPlayerBestAsync(BoardId board, PlayerId player, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    BoardId board
    PlayerId player
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<LeaderboardEntry?>

    GetRankAsync(BoardId, PlayerId, LeaderboardSortDirection, CancellationToken)

    Declaration
    public Task<int> GetRankAsync(BoardId board, PlayerId player, LeaderboardSortDirection direction, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    BoardId board
    PlayerId player
    LeaderboardSortDirection direction
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<int>

    GetStoredEntryCount(BoardId)

    Test-only inspection of the raw stored entry count for a board. Not part of ILeaderboardStore — used by tests to assert on retention-mode behavior.

    Declaration
    public int GetStoredEntryCount(BoardId board)
    Parameters
    Type Name Description
    BoardId board

    The board to inspect.

    Returns
    Type Description
    int

    GetTopAsync(BoardId, int, LeaderboardSortDirection, LeaderboardRankingMode, CancellationToken)

    Declaration
    public Task<IReadOnlyList<LeaderboardEntry>> GetTopAsync(BoardId board, int count, LeaderboardSortDirection direction, LeaderboardRankingMode rankingMode, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    BoardId board
    int count
    LeaderboardSortDirection direction
    LeaderboardRankingMode rankingMode
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IReadOnlyList<LeaderboardEntry>>

    GetTopAsync(BoardId, int, LeaderboardSortDirection, CancellationToken)

    Declaration
    public Task<IReadOnlyList<LeaderboardEntry>> GetTopAsync(BoardId board, int count, LeaderboardSortDirection direction, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    BoardId board
    int count
    LeaderboardSortDirection direction
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IReadOnlyList<LeaderboardEntry>>

    HealthCheckAsync(CancellationToken)

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

    SubmitAsync(LeaderboardEntry, LeaderboardDefinition, CancellationToken)

    Declaration
    public Task SubmitAsync(LeaderboardEntry entry, LeaderboardDefinition board, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    LeaderboardEntry entry
    LeaderboardDefinition board
    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    Implements

    ILeaderboardStore
    In this article
    © 2026 Serenity. All Rights Reserved