Caching is a very important part of EvenCart. It makes sure that performance of the site is not affected due to repeated database and network calls.
Available Cache Providers
Out of box EvenCart supports the following cache providers. You can however create your own cache provides by either implementing interface ICacheProvider
or extending class FoundationCacheProvider<>
available in EvenCart.Core.Caching
- Request Cache Provider
- Memory Cache Provider
- Redis Cache Provider
Request Cache Provider
The request cache provider is used for caching data within a single request. The provider ensures that a single request doesn't have to perform same resource intensive operations repeatedly. It is always used no matter caching is enabled or not.
Memory Cache Provider
The memory cache provider is the default cache provider. It caches the data in the Application Pool's memory. While it is okay for small websites, you may want to use some advance cache provider such as Redis for your enterprise level applications.
Redis Cache Provider
Redis is a distributed cache and data store. EvenCart out of box supports Redis Distributed Cache. However it's not enabled by default.
To enable Redis cache support, you need to enable the cache via appsettings.json
configuration file. The file is available at the root directory of your EvenCart installation. You need to change the following values to enable Redis Cache.
Note : Redis Cache is not available upto EvenCart versions 1.10
{
.
.
.
"cacheProvider": "redis",
"redisConfig": "your redis configuration"
.
.
}
If you wish to disable Redis Cache set the
cacheProvider
setting back todefault
Redis Config
Redis config setting above is the configuration string that contains various parameters required to connect to Redis Server. You can read about configuration settings at this Redis Page.