- 1. Introduction
- 2. Basics
- 5. Extensions
- 6. Manager Extensions
Last Updated: 2019-03-02
The Simple Cache is an in-process memory cache based on an
IDictionary<string, object>. It's fast and does the job for simple runtime scenarios. The simple cache is included in the core
Piranha package meaning that no additional packages needs to be installed to use it.
Register The Service
To register the simple cache, simply add the following call to your
public void ConfigureServices(IServiceCollection services)
This will register the cache as a
Singleton and it will be injected into all repositories. Please note that to actually use the cache in the repositories you need to set the current Cache Level of your application. For more information see Caching.
About Simple Cache
Please note that since simple caching is handled in the memory of the web server process it does not work well for web farms or clustered environments. For these types of setups you should consider using a distributed cache.