#### [Abblix\.Oidc\.Server\.MinimalApi](https://www.abblix.com/en/docs/api/abblix-oidc-server-minimalapi 'index')
### [Abblix\.Oidc\.Server\.MinimalApi\.Features\.SessionManagement](https://www.abblix.com/en/docs/api/abblix-oidc-server-minimalapi/Abblix.Oidc.Server.MinimalApi.Features.SessionManagement 'Abblix\.Oidc\.Server\.MinimalApi\.Features\.SessionManagement')

## CheckSessionResponseCache Class

In\-memory cache for formatted check\-session results\. The result objects are stateless \(they hold only the HTML
template and mint a fresh nonce per execution\), so caching them across requests is safe\.

```csharp
public class CheckSessionResponseCache : Abblix.Oidc.Server.MinimalApi.Features.SessionManagement.ICheckSessionResponseCache
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → CheckSessionResponseCache

Implements [ICheckSessionResponseCache](https://www.abblix.com/en/docs/api/abblix-oidc-server-minimalapi/Abblix.Oidc.Server.MinimalApi.Features.SessionManagement.ICheckSessionResponseCache 'Abblix\.Oidc\.Server\.MinimalApi\.Features\.SessionManagement\.ICheckSessionResponseCache')
### Constructors

## CheckSessionResponseCache\(IOptions\<MemoryCacheOptions\>\) Constructor {#Abblix.Oidc.Server.MinimalApi.Features.SessionManagement.CheckSessionResponseCache.CheckSessionResponseCache(Microsoft.Extensions.Options.IOptions_Microsoft.Extensions.Caching.Memory.MemoryCacheOptions_)}

In\-memory cache for formatted check\-session results\. The result objects are stateless \(they hold only the HTML
template and mint a fresh nonce per execution\), so caching them across requests is safe\.

```csharp
public CheckSessionResponseCache(Microsoft.Extensions.Options.IOptions<Microsoft.Extensions.Caching.Memory.MemoryCacheOptions> cacheOptions);
```
#### Parameters

###### `cacheOptions` [Microsoft\.Extensions\.Options\.IOptions&lt;](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.options.ioptions-1 'Microsoft\.Extensions\.Options\.IOptions\`1')[Microsoft\.Extensions\.Caching\.Memory\.MemoryCacheOptions](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.caching.memory.memorycacheoptions 'Microsoft\.Extensions\.Caching\.Memory\.MemoryCacheOptions')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.options.ioptions-1 'Microsoft\.Extensions\.Options\.IOptions\`1') {#Abblix.Oidc.Server.MinimalApi.Features.SessionManagement.CheckSessionResponseCache.CheckSessionResponseCache(Microsoft.Extensions.Options.IOptions_Microsoft.Extensions.Caching.Memory.MemoryCacheOptions_).cacheOptions}
### Methods

## CheckSessionResponseCache\.GetOrAddAsync\(object, Func\<Task\<IResult\>\>\) Method {#Abblix.Oidc.Server.MinimalApi.Features.SessionManagement.CheckSessionResponseCache.GetOrAddAsync(object,System.Func_System.Threading.Tasks.Task_Microsoft.AspNetCore.Http.IResult__)}

Gets the result for the key from the cache, or produces and stores it via [factory](https://www.abblix.com/en/docs/api/abblix-oidc-server-minimalapi/Abblix.Oidc.Server.MinimalApi.Features.SessionManagement.CheckSessionResponseCache#Abblix.Oidc.Server.MinimalApi.Features.SessionManagement.CheckSessionResponseCache.GetOrAddAsync(object,System.Func_System.Threading.Tasks.Task_Microsoft.AspNetCore.Http.IResult__).factory 'Abblix\.Oidc\.Server\.MinimalApi\.Features\.SessionManagement\.CheckSessionResponseCache\.GetOrAddAsync\(object, System\.Func\<System\.Threading\.Tasks\.Task\<Microsoft\.AspNetCore\.Http\.IResult\>\>\)\.factory')\.

```csharp
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Http.IResult> GetOrAddAsync(object key, System.Func<System.Threading.Tasks.Task<Microsoft.AspNetCore.Http.IResult>> factory);
```
#### Parameters

###### `key` [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') {#Abblix.Oidc.Server.MinimalApi.Features.SessionManagement.CheckSessionResponseCache.GetOrAddAsync(object,System.Func_System.Threading.Tasks.Task_Microsoft.AspNetCore.Http.IResult__).key}

The key identifying the cached result\.

###### `factory` [System\.Func&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.func-1 'System\.Func\`1')[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[Microsoft\.AspNetCore\.Http\.IResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.iresult 'Microsoft\.AspNetCore\.Http\.IResult')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.func-1 'System\.Func\`1') {#Abblix.Oidc.Server.MinimalApi.Features.SessionManagement.CheckSessionResponseCache.GetOrAddAsync(object,System.Func_System.Threading.Tasks.Task_Microsoft.AspNetCore.Http.IResult__).factory}

Produces the result when the key is not yet cached\.

Implements [GetOrAddAsync\(object, Func&lt;Task&lt;IResult&gt;&gt;\)](https://www.abblix.com/en/docs/api/abblix-oidc-server-minimalapi/Abblix.Oidc.Server.MinimalApi.Features.SessionManagement.ICheckSessionResponseCache#Abblix.Oidc.Server.MinimalApi.Features.SessionManagement.ICheckSessionResponseCache.GetOrAddAsync(object,System.Func_System.Threading.Tasks.Task_Microsoft.AspNetCore.Http.IResult__) 'Abblix\.Oidc\.Server\.MinimalApi\.Features\.SessionManagement\.ICheckSessionResponseCache\.GetOrAddAsync\(object, System\.Func\<System\.Threading\.Tasks\.Task\<Microsoft\.AspNetCore\.Http\.IResult\>\>\)')

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[Microsoft\.AspNetCore\.Http\.IResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.iresult 'Microsoft\.AspNetCore\.Http\.IResult')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
The cached or newly produced [Microsoft\.AspNetCore\.Http\.IResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.iresult 'Microsoft\.AspNetCore\.Http\.IResult')\.
