2.0 Extending LazyCache with Redis, Cassandra etc

Alastair Crabtree edited this page Mar 4, 2018 · 1 revision

To extend the cache or use a cache library other than MemoryCache such as an Sql Server cache (say) just implement ObjectCache and pass it into the constructor.

     // construct our implementation of ObjectCache
     var customObjectCache = new BespokeCache();

     // Pass it into the lazy cache - 
     var cache = new CachingService(customObjectCache);

     // Now when we use cache it will use customObjectCache

There are several open source implementations of object cache:

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.