Class DistributedCache
The distributed cache.
Implements
Inherited Members
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 |
|---|---|---|
| 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 |
|---|---|---|
| string | key | The key. |
Returns
| Type | Description |
|---|---|
| byte[] | The cache entry or null. |
GetAsync(string)
Gets the entry from the cache.
Declaration
public Task<byte[]?> GetAsync(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key. |
Returns
| Type | Description |
|---|---|
| Task<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 |
|---|---|---|
| string | key | The key. |
RefreshAsync(string)
Refreshes the entry in the cache.
Declaration
public Task RefreshAsync(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| 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 |
|---|---|---|
| string | key | The key. |
RemoveAsync(string)
Removes the entry from the cache.
Declaration
public Task RemoveAsync(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the remove operation. |
Set(string, byte[], TimeSpan?, 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 |
|---|---|---|
| string | key | The key. |
| byte[] | bytes | The cache entry. |
| TimeSpan? | slidingExpiration | The sliding expiration. |
| DateTimeOffset? | absoluteExpiration | The absolute expiration. |
SetAsync(string, byte[], TimeSpan?, DateTimeOffset?)
Sets the entry in the cache.
Declaration
public Task SetAsync(string key, byte[] bytes, TimeSpan? slidingExpiration = null, DateTimeOffset? absoluteExpiration = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key. |
| byte[] | bytes | The cache entry. |
| TimeSpan? | slidingExpiration | The sliding expiration. |
| DateTimeOffset? | absoluteExpiration | The absolute expiration. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the set operation. |