using VoidCat.Services.Abstractions;
namespace VoidCat.Services;
///
public abstract class BasicCacheStore : IBasicStore
{
protected readonly ICache Cache;
protected BasicCacheStore(ICache cache)
{
Cache = cache;
}
///
public virtual ValueTask Get(Guid id)
{
return Cache.Get(MapKey(id));
}
///
public virtual ValueTask Add(Guid id, TStore obj)
{
return Cache.Set(MapKey(id), obj);
}
///
public virtual ValueTask Delete(Guid id)
{
return Cache.Delete(MapKey(id));
}
///
/// Map an id to a key in the KV store
///
///
///
protected abstract string MapKey(Guid id);
}