Show / Hide Table of Contents

Class DistributedCache

The distributed cache.

Inheritance
System.Object
DistributedCache
Implements
ICache
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: ComponentSpace.OpenID.Cache
Assembly: ComponentSpace.OpenID.dll
Syntax
public class DistributedCache : ICache

Constructors

DistributedCache(IDistributedCache)

Initializes a new instance of the DistributedCache class.

Declaration
public DistributedCache(IDistributedCache distributedCache)
Parameters
Type Name Description
Microsoft.Extensions.Caching.Distributed.IDistributedCache distributedCache

The distributed cache used to store entries.

Methods

Get(String)

Gets the entry from the cache.

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

The key.

Returns
Type Description
System.Byte[]

The cache entry or null.

GetAsync(String)

Gets the entry from the cache.

Declaration
public async Task<byte[]> GetAsync(string key)
Parameters
Type Name Description
System.String key

The key.

Returns
Type Description
Task<System.Byte[]>

A task that represents the get operation and returns the cache entry or null.

Refresh(String)

Refreshes the entry in the cache.

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

The key.

RefreshAsync(String)

Refreshes the entry in the cache.

Declaration
public async Task RefreshAsync(string key)
Parameters
Type Name Description
System.String key

The key.

Returns
Type Description
Task

A task that represents the refresh operation.

Remove(String)

Removes the entry from the cache.

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

The key.

RemoveAsync(String)

Removes the entry from the cache.

Declaration
public async Task RemoveAsync(string key)
Parameters
Type Name Description
System.String key

The key.

Returns
Type Description
Task

A task that represents the remove operation.

Set(String, Byte[], Nullable<TimeSpan>, Nullable<DateTimeOffset>)

Sets the entry in the cache.

Declaration
public void Set(string key, byte[] bytes, TimeSpan? slidingExpiration = null, DateTimeOffset? absoluteExpiration = null)
Parameters
Type Name Description
System.String key

The key.

System.Byte[] bytes

The cache entry.

System.Nullable<TimeSpan> slidingExpiration

The sliding expiration.

System.Nullable<DateTimeOffset> absoluteExpiration

The absolute expiration.

SetAsync(String, Byte[], Nullable<TimeSpan>, Nullable<DateTimeOffset>)

Sets the entry in the cache.

Declaration
public async Task SetAsync(string key, byte[] bytes, TimeSpan? slidingExpiration = null, DateTimeOffset? absoluteExpiration = null)
Parameters
Type Name Description
System.String key

The key.

System.Byte[] bytes

The cache entry.

System.Nullable<TimeSpan> slidingExpiration

The sliding expiration.

System.Nullable<DateTimeOffset> absoluteExpiration

The absolute expiration.

Returns
Type Description
Task

A task that represents the set operation.

Implements

ICache
In This Article
Back to top Copyright © ComponentSpace Pty Ltd 2022. All rights reserved.