|
|
|
|
using System.Collections.Immutable;
|
|
|
|
|
|
|
|
|
|
namespace Connected.Caching;
|
|
|
|
|
|
|
|
|
|
public delegate void CacheInvalidateHandler(CacheEventArgs e);
|
|
|
|
|
public interface ICache : IDisposable
|
|
|
|
|
{
|
|
|
|
|
event CacheInvalidateHandler? Invalidating;
|
|
|
|
|
event CacheInvalidateHandler? Invalidated;
|
|
|
|
|
|
|
|
|
|
ImmutableList<T>? All<T>(string key);
|
|
|
|
|
|
|
|
|
|
Task<T?> Get<T>(string key, object id, Func<EntryOptions, Task<T?>>? retrieve);
|
|
|
|
|
T? Get<T>(string key, object id);
|
|
|
|
|
IEntry? Get(string key, object id);
|
|
|
|
|
Task<T?> Get<T>(string key, Func<T, bool> predicate, Func<EntryOptions, Task<T?>>? retrieve);
|
|
|
|
|
T? Get<T>(string key, Func<T, bool> predicate);
|
|
|
|
|
T? First<T>(string key);
|
|
|
|
|
IEnumerator<T>? GetEnumerator<T>(string key);
|
|
|
|
|
|
|
|
|
|
ImmutableList<T>? Where<T>(string key, Func<T, bool> predicate);
|
|
|
|
|
bool Exists(string key);
|
|
|
|
|
bool IsEmpty(string key);
|
|
|
|
|
void CreateKey(string key);
|
|
|
|
|
Task Clear(string key);
|
|
|
|
|
|
|
|
|
|
T? Set<T>(string key, object id, T? instance);
|
|
|
|
|
T? Set<T>(string key, object id, T? instance, TimeSpan duration);
|
|
|
|
|
T? Set<T>(string key, object id, T? instance, TimeSpan duration, bool slidingExpiration);
|
|
|
|
|
void CopyTo(string key, object id, IEntry entry);
|
|
|
|
|
Task<ImmutableList<string>?> Remove<T>(string key, Func<T, bool> predicate);
|
|
|
|
|
Task Remove(string key, object id);
|
|
|
|
|
Task Invalidate(string key, object id);
|
|
|
|
|
|
|
|
|
|
int Count(string key);
|
|
|
|
|
bool Any(string key);
|
|
|
|
|
ImmutableList<string>? Keys(string key);
|
|
|
|
|
ImmutableList<string>? Keys();
|
|
|
|
|
}
|