i found this interface and i want to use it. But i dont understand how to use the Create function...
namespace Microsoft.Extensions.Caching.Memory
{
public interface IMemoryCache : IDisposable
{
ICacheEntry CreateEntry(object key);
void Remove(object key);
bool TryGetValue(object key, out object value);
}
}
How to store something in CreateEntry when there is only the key not the value in the function call? How to store something in the key?
So i have this:
class RedisObjectTestCache : IMemoryCache
{
public ICacheEntry CreateEntry(object key)
{
Console.WriteLine("Created key: " + key);
return new CacheEntryTest() { };
}
public void Dispose()
{
Console.WriteLine("Dispose");
return;
}
public void Remove(object key)
{
Console.WriteLine("Removed key: " + key);
return;
}
public bool TryGetValue(object key, out object value)
{
Console.WriteLine("Requested key: " + key);
value = "";
return false;
}
}
and then i call it with the framework:
QueryCacheManager.Cache = new RedisObjectTestCache();
Can i somehow get the value?