Skip to content

Extending LazyCache with Redis, Cassandra etc (v0.7.x)

Alastair Crabtree edited this page Feb 25, 2019 · 3 revisions

NOTE: This is for LazyCache 0.7 or lower. For LazyCache v2+ users consider switching to IDistributedCache

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:

Clone this wiki locally