MethodCache.Fody icon indicating copy to clipboard operation
MethodCache.Fody copied to clipboard

Support IDistributedCache interface (synchronous)

Open Dresel opened this issue 5 years ago • 0 comments

Support the usage of caches based on the IDistributedCache interface.

For the first iteration only the following synchronous methods will be used:


// IDistributedCache interface
byte[] Get(string key);

// DistributedCacheExtensions
public static void Set (this Microsoft.Extensions.Caching.Distributed.IDistributedCache cache, string key, byte[] value);

The key has to be formatted as string. We will provide a default implementation, similar to the old MethodCache where the ToString() representations of arguments will be concatenated and delimited by a configurable char ('_' will be used as default).

This should be sufficient for most use cases. Customization will be possible by providing a IDistributedCacheKeyFormatter implementation.

The same challenge applies to the value which has to be formatted as byte[]. Customization will be possible by providing a IDistributedCacheValueFormatter implementation. We might consider a default implementation (probably JSON.Net serialization / deserialization).

Dresel avatar Nov 06 '20 12:11 Dresel