Skip to content

GetOrInsertAsync Method ​

Definition ​

  • Namespace: JASE.Interfaces
  • Assembly: JASE.Caching.dll

Overloads ​

NameDescription
Task<T> GetOrInsertAsync(string key, Func<CancellationToken, Task<T>> factory, CancellationToken ct = null)Retrieves an item from the cache cast to type of T, or inserts using the provided Factory function
Task<T> GetOrInsertAsync(string key, string filename, Func<CancellationToken, Task<T>> factory, CancellationToken ct = null)Retrieves an item from the cache cast to type of T, or inserts using the provided Factory function and file dependency
Task<T> GetOrInsertAsync(string key, Func<CancellationToken, Task<T>> factory, TimeSpan expiration, bool sliding = null, CancellationToken ct = null)Retrieves an item from the cache cast to type of T, or inserts using the provided Factory function with TimeSpan expiration

Task<T> GetOrInsertAsync(string key, Func<CancellationToken, Task<T>> factory, CancellationToken ct = null) ​

csharp
Task<T> GetOrInsertAsync(string key, Func<CancellationToken, Task<T>> factory, CancellationToken ct = null)

Retrieves an item from the cache cast to type of T, or inserts using the provided Factory function

Task<T> GetOrInsertAsync(string key, Func<CancellationToken, Task<T>> factory, TimeSpan expiration, bool sliding = null, CancellationToken ct = null) ​

csharp
Task<T> GetOrInsertAsync(string key, Func<CancellationToken, Task<T>> factory, TimeSpan expiration, bool sliding = null, CancellationToken ct = null)

Retrieves an item from the cache cast to type of T, or inserts using the provided Factory function with TimeSpan expiration

Task<T> GetOrInsertAsync(string key, string filename, Func<CancellationToken, Task<T>> factory, CancellationToken ct = null) ​

csharp
Task<T> GetOrInsertAsync(string key, string filename, Func<CancellationToken, Task<T>> factory, CancellationToken ct = null)

Retrieves an item from the cache cast to type of T, or inserts using the provided Factory function and file dependency