Using Both (Extend & Override)
You’re not limited to just one approach—you can combine overriding existing methods and adding new ones in a single custom cache service. This gives you full flexibility:
Override methods to change or enhance built-in behavior.
Extend by introducing brand new methods that fit your project’s unique needs.
For example, you can override SetAsync to add logging or custom serialization, while also introducing a brand new method like RemoveAllByPrefix.
This is the power of REN.Kit’s design: your cache service can be as standard or as custom as you want.
Tip:
Just inherit from the base cache service (like RENInMemoryCacheService), override any method you need, and add your own new methods—all in the same class!
How to Use Both?
1. Create a New Service Interface to Implement New Method
public interface IExtendedRENInMemoryCacheService : IRENCacheService
{
void AdditionalMethod();
}This interface introduces new method while keep using the default ones
2. Create a New Service to Implement New Method
3. Register Your Custom Implementation
Since you are not using the default interface now (you've introduced new method and this method should be taken into account) You should register interface and classes like:
4. Use Custom Service In Action
Last updated