-
Notifications
You must be signed in to change notification settings - Fork 159
Extending LazyCache with Redis, Cassandra etc (v0.7.x)
pat macpherson edited this page Apr 1, 2019
·
3 revisions
NOTE: This is for LazyCache 0.7 or lower.
For LazyCache v2+ users, you should consider switching away from LazyCache to IDistributedCache. More information at #59
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:
- FileCache: http://fc.codeplex.com/
- RedisCache: https://github.com/justinfinch/Redis-Object-Cache
- Cassandra: https://github.com/luckyllama/Lucky.Cassandra