Show / Hide Table of Contents

# Interface IOpenIddictTokenCache<TToken>

Provides methods allowing to cache tokens after retrieving them from the store.

###### Namespace: OpenIddict.Abstractions

###### Assembly: cs.temp.dll.dll

##### Syntax

    public interface IOpenIddictTokenCache<TToken>
        where TToken : class

##### Type Parameters

Name | Description
--- | ---
TToken | The type of the Token entity.

### Methods

#### AddAsync(TToken, CancellationToken)

Add the specified token to the cache.

##### Declaration

    ValueTask AddAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token to add to the cache.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### FindAsync(String, String, CancellationToken)

Retrieves the tokens corresponding to the specified subject and associated with the application identifier.

##### Declaration

    IAsyncEnumerable<TToken> FindAsync(string subject, string client, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | subject | The subject associated with the token.
System.String | client | The client associated with the token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> | The tokens corresponding to the subject/client.

#### FindAsync(String, String, String, CancellationToken)

Retrieves the tokens matching the specified parameters.

##### Declaration

    IAsyncEnumerable<TToken> FindAsync(string subject, string client, string status, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | subject | The subject associated with the token.
System.String | client | The client associated with the token.
System.String | status | The token status.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> | The tokens corresponding to the criteria.

#### FindAsync(String, String, String, String, CancellationToken)

Retrieves the tokens matching the specified parameters.

##### Declaration

    IAsyncEnumerable<TToken> FindAsync(string subject, string client, string status, string type, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | subject | The subject associated with the token.
System.String | client | The client associated with the token.
System.String | status | The token status.
System.String | type | The token type.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> | The tokens corresponding to the criteria.

#### FindByApplicationIdAsync(String, CancellationToken)

Retrieves the list of tokens corresponding to the specified application identifier.

##### Declaration

    IAsyncEnumerable<TToken> FindByApplicationIdAsync(string identifier, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | identifier | The application identifier associated with the tokens.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> | The tokens corresponding to the specified application.

#### FindByAuthorizationIdAsync(String, CancellationToken)

Retrieves the list of tokens corresponding to the specified authorization identifier.

##### Declaration

    IAsyncEnumerable<TToken> FindByAuthorizationIdAsync(string identifier, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | identifier | The authorization identifier associated with the tokens.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> | The tokens corresponding to the specified authorization.

#### FindByIdAsync(String, CancellationToken)

Retrieves a token using its unique identifier.

##### Declaration

    ValueTask<TToken> FindByIdAsync(string identifier, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | identifier | The unique identifier associated with the token.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<TToken> | A that can be used to monitor the asynchronous operation, whose result returns the token corresponding to the unique identifier.

#### FindByReferenceIdAsync(String, CancellationToken)

Retrieves the list of tokens corresponding to the specified reference identifier. Note: the reference identifier may be hashed or encrypted for security reasons.

##### Declaration

    ValueTask<TToken> FindByReferenceIdAsync(string identifier, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | identifier | The reference identifier associated with the tokens.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<TToken> | A that can be used to monitor the asynchronous operation, whose result returns the tokens corresponding to the specified reference identifier.

#### FindBySubjectAsync(String, CancellationToken)

Retrieves the list of tokens corresponding to the specified subject.

##### Declaration

    IAsyncEnumerable<TToken> FindBySubjectAsync(string subject, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | subject | The subject associated with the tokens.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> | The tokens corresponding to the specified subject.

#### RemoveAsync(TToken, CancellationToken)

Removes the specified token from the cache.

##### Declaration

    ValueTask RemoveAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token | The token to remove from the cache.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.