Search code examples
c#.netredisin-memory-cache

Redis Cache + InMemoryCache implementations, we need them both in a configurable way


i have a senario , currently both redis cache and inMemorycache is being used in project.we want something configurable like pick value from Appsetting then initialize either a redis service or in memory cache service..and we can switch between them any time. Definitely we need to implement IRedisService and IMemoryCache Interfaces in a similar way so that if its switch no exception is thrown. but is t possible? as both have there own ways of implementing things like setting and getting values etc.

any suggestions on this are welcome. i am new to this cache stuff

currently trying to implement it but stuck over keeping similar implementation


Solution

  • You might want to look into Redis server assisted client-side caching. https://redis.io/docs/manual/client-side-caching. Some OSS Redis client libraries might not be supporting this yet.