Usage
After the configuration, you should install Eiffel.Caching.Abstractions NuGet package into your application. This package contains common interfaces such as ICacheService
, ICacheServiceFactory
etc.
dotnet add package Eiffel.Caching.Abstractions
In your application services, controllers or other infrastructure service you can use ICacheService
with dependency injection.
public class BookingService
{
private readonly ICacheService _cacheService;
public BookingService(ICacheService cacheService)
{
_cacheService = cacheService;
}
.. // Your implementation details
}
If you want to separate your data between different indexes in Redis you can use ICacheServiceFactory
public class BookingService
{
const int BookingCacheIndex = 10;
private readonly ICacheService _cacheService;
public BookingService(ICacheServiceFactory cacheServiceFactory)
{
_cacheService = cacheServiceFactory.Resolve(BookingCacheIndex);
}
.. // Your implementation details
}
Last updated