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);
}