DataWeb
Search Results for

    Show / Hide Table of Contents

    Interface ICacheService

    Interface for caching service that provides methods for managing cached data.

    Namespace: DataWeb.Data
    Assembly: DataWeb.Core.dll
    Syntax
    public interface ICacheService

    Properties

    Name

    Gets the name of the cache service instance.

    Declaration
    string Name { get; }
    Property Value
    Type Description
    string

    Methods

    ClearAsync(CancellationToken)

    Clears all cached data.

    Declaration
    Task ClearAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task that represents the asynchronous clear operation.

    GetAsync<T>(string, Func<Task<T>>, string[], IUser, DateTime?, CancellationToken)

    Retrieves the cached data associated with the specified key.

    Declaration
    Task<T> GetAsync<T>(string key, Func<Task<T>> fetchDelegate, string[] dependencies = null, IUser user = null, DateTime? expiration = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string key

    The key of the cached data to retrieve.

    Func<Task<T>> fetchDelegate

    A function that retrieves the data to cache if it's not already cached.

    string[] dependencies

    An array of dependency keys for the cached data.

    IUser user

    The user associated with the cached data.

    DateTime? expiration

    The expiration time of the cached data.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<T>

    The cached data associated with the specified key.

    Type Parameters
    Name Description
    T

    The type of the cached data to retrieve.

    GetSectionCacheAsync<T>(string, Func<Task<T>>, string[], IUser, DateTime?, CancellationToken)

    Retrieves the cached data associated with the specified key and sections.

    Declaration
    Task<T> GetSectionCacheAsync<T>(string key, Func<Task<T>> fetchDelegate, string[] sections, IUser user = null, DateTime? expiration = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string key

    The key of the cached data to retrieve.

    Func<Task<T>> fetchDelegate

    A function that retrieves the data to cache if it's not already cached.

    string[] sections

    An array of section names for the cached data.

    IUser user

    The user associated with the cached data.

    DateTime? expiration

    The expiration time of the cached data.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<T>

    The cached data associated with the specified key and sections.

    Type Parameters
    Name Description
    T

    The type of the cached data to retrieve.

    RemoveAsync(string, CancellationToken)

    Removes the cached data associated with the specified key.

    Declaration
    Task RemoveAsync(string key, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string key

    The key of the cached data to remove.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task that represents the asynchronous remove operation.

    SetAsync<T>(string, T, string[], DateTime?, CancellationToken)

    Caches the specified data associated with the specified key.

    Declaration
    Task SetAsync<T>(string key, T value, string[] dependencies = null, DateTime? expiration = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string key

    The key to associate with the cached data.

    T value

    The data to cache.

    string[] dependencies

    An array of dependency keys for the cached data.

    DateTime? expiration

    The expiration time of the cached data.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task that represents the asynchronous set operation.

    Type Parameters
    Name Description
    T

    The type of the data to cache.

    In this article
    Back to top Generated by DocFX