dotnetcore / EasyCaching

:boom: EasyCaching is an open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
MIT License
1.92k stars 321 forks source link

Custom cache key generator? #464

Closed tietoevry-johan closed 1 year ago

tietoevry-johan commented 1 year ago

Description

Hi, is there any way override the cache key generator?

It's a similar use case to https://github.com/dotnetcore/EasyCaching/issues/445, but I would just like to inject my tenant context in to the cache key generator and add the tenant ID as a prefix.

Specifications

catcherwong commented 1 year ago

@tietoevry-johan Thanks for your interest in this project.

In EasyCaching, only interceptor contains cache key generator IEasyCachingKeyGenerator.

When you call method Set(Async) or Get(Async), the cache key was defined by yourself.

tietoevry-johan commented 1 year ago

@catcherwong alright, thanks for the update and a nice library :)