Show / Hide Table of Contents

    Class LocalFileDistributedCache

    Represents a distributed cache of serialized values that reads/writes from/to a local file.

    Inheritance
    System.Object
    LocalFileDistributedCache
    Namespace: Copper.Conventions.Method.Common.V1
    Assembly: Copper.Conventions.Method.Common.dll
    Syntax
    public class LocalFileDistributedCache : IDistributedCache

    Constructors

    View Source

    LocalFileDistributedCache(IOptions<LocalFileDistributedCacheOptions>)

    Initializes a new instance of the LocalFileDistributedCache class.

    Declaration
    public LocalFileDistributedCache(IOptions<LocalFileDistributedCacheOptions> localFileDistributedCacheOptions)
    Parameters
    Type Name Description
    IOptions<LocalFileDistributedCacheOptions> localFileDistributedCacheOptions

    The local file distributed cache options.

    Methods

    View Source

    Get(String)

    Gets a value with the given key.

    Declaration
    public byte[] Get(string key)
    Parameters
    Type Name Description
    System.String key

    A string identifying the requested value.

    Returns
    Type Description
    System.Byte[]

    The located value or null.

    View Source

    GetAsync(String, CancellationToken)

    Gets a value with the given key.

    Declaration
    public Task<byte[]> GetAsync(string key, CancellationToken token = default(CancellationToken))
    Parameters
    Type Name Description
    System.String key

    A string identifying the requested value.

    System.Threading.CancellationToken token

    Optional. The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Byte[]>

    The System.Threading.Tasks.Task that represents the asynchronous operation, containing the located value or null.

    View Source

    Refresh(String)

    Refreshes a value in the cache based on its key, resetting its sliding expiration timeout (if any).

    Declaration
    public void Refresh(string key)
    Parameters
    Type Name Description
    System.String key

    A string identifying the requested calue.

    Exceptions
    Type Condition
    System.NotSupportedException

    Refresh is not supported by LocalFileDistributedCache.

    View Source

    RefreshAsync(String, CancellationToken)

    Refreshes a value in the cache based on its key, resetting its sliding expiration timeout (if any).

    Declaration
    public Task RefreshAsync(string key, CancellationToken token = default(CancellationToken))
    Parameters
    Type Name Description
    System.String key

    A string identifying the requested value.

    System.Threading.CancellationToken token

    Optional. The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled.

    Returns
    Type Description
    System.Threading.Tasks.Task

    The System.Threading.Tasks.Task that represents the asynchronous operation.

    Exceptions
    Type Condition
    System.NotSupportedException

    Refresh is not supported by LocalFileDistributedCache.

    View Source

    Remove(String)

    Removes the value with the given key.

    Declaration
    public void Remove(string key)
    Parameters
    Type Name Description
    System.String key

    A string identifying the requested value.

    View Source

    RemoveAsync(String, CancellationToken)

    Removes the value with the given key.

    Declaration
    public Task RemoveAsync(string key, CancellationToken token = default(CancellationToken))
    Parameters
    Type Name Description
    System.String key

    A string identifying the requested value.

    System.Threading.CancellationToken token

    Optional. The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled.

    Returns
    Type Description
    System.Threading.Tasks.Task

    The System.Threading.Tasks.Task that represents the asynchronous operation.

    View Source

    Set(String, Byte[], DistributedCacheEntryOptions)

    Sets a value with the given key.

    Declaration
    public void Set(string key, byte[] value, DistributedCacheEntryOptions options)
    Parameters
    Type Name Description
    System.String key

    A string identifying the requested value.

    System.Byte[] value

    The value to set in the cache.

    DistributedCacheEntryOptions options

    The cache options for the value.

    View Source

    SetAsync(String, Byte[], DistributedCacheEntryOptions, CancellationToken)

    Sets the value with the given key.

    Declaration
    public Task SetAsync(string key, byte[] value, DistributedCacheEntryOptions options, CancellationToken token = default(CancellationToken))
    Parameters
    Type Name Description
    System.String key

    A string identifying the requested value.

    System.Byte[] value

    The value to set in the cache.

    DistributedCacheEntryOptions options

    The cache options for the value.

    System.Threading.CancellationToken token

    Optional. The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled.

    Returns
    Type Description
    System.Threading.Tasks.Task

    The System.Threading.Tasks.Task that represents the asynchronous operation.

    Exceptions
    Type Condition
    System.NotSupportedException
    • View Source
    Back to top Generated by DocFX