2021-03-22 12:09:25 -04:00
|
|
|
|
using System;
|
2022-06-09 10:56:41 -04:00
|
|
|
|
using System.Collections.Generic;
|
2021-08-26 18:35:05 -04:00
|
|
|
|
using System.Threading;
|
2021-03-22 12:09:25 -04:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
|
|
namespace Data.Abstractions
|
|
|
|
|
{
|
2021-11-15 11:25:55 -05:00
|
|
|
|
public interface IDataValueCache<TEntityType, TReturnType> where TEntityType : class
|
2021-03-22 12:09:25 -04:00
|
|
|
|
{
|
2021-11-15 11:25:55 -05:00
|
|
|
|
void SetCacheItem(Func<DbSet<TEntityType>, CancellationToken, Task<TReturnType>> itemGetter, string keyName,
|
|
|
|
|
TimeSpan? expirationTime = null, bool autoRefresh = false);
|
2022-06-09 10:56:41 -04:00
|
|
|
|
|
2023-04-19 20:55:33 -04:00
|
|
|
|
void SetCacheItem(Func<DbSet<TEntityType>, IEnumerable<object>, CancellationToken, Task<TReturnType>> itemGetter, string keyName,
|
2022-06-09 10:56:41 -04:00
|
|
|
|
IEnumerable<object> ids = null, TimeSpan? expirationTime = null, bool autoRefresh = false);
|
|
|
|
|
|
2021-11-15 11:25:55 -05:00
|
|
|
|
Task<TReturnType> GetCacheItem(string keyName, CancellationToken token = default);
|
2023-04-19 20:55:33 -04:00
|
|
|
|
|
|
|
|
|
Task<TReturnType> GetCacheItem(string keyName, IEnumerable<object> ids = null, CancellationToken token = default);
|
2021-03-22 12:09:25 -04:00
|
|
|
|
}
|
2022-06-09 10:56:41 -04:00
|
|
|
|
}
|