It says Redis is required in the documentation. Why do we need to install Redis for ABP? If we don't install it, what happens?
1 Answer(s)
-
0
As a summary
-
If you deploy your application as multiple instances, you need a distributed cache, like Redis.
-
If you have multiple applications (like a microservice or distributed solution) that need to share the same cache objects, you need to have a distributed cache, like Redis.
-
ABP's default cache is In-Memory Cache. It is usable only if you have a single application with a single instance running on a single server. Even in that scenario, it's good to use Redis because your cached objects are not erased when the application restarts.
What's Redis?
-
Redis (REmote DIctionary Server). This open-source application provides in-memory caching. It is known for its high-performance capabilities.
-
It’s very fast for reading/writing data. That’s why we use Redis for distributed cache in the following projects
Where is Redis being used in ABP projects?
-
Blazor.Server.Tiered https://github.com/abpframework/abp/blob/dev/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/appsettings.json
Why must we use Redis in ABP projects?
You only need to install Redis for the
n-tier
architecture where Web and HTTP API layers are physically separated. If you work on ann-layered
solution with no HTTP API project, then you don't need Redis.You can see in which cases Redis is pre-required from the documentation page:
docs.abp.io/en/abp/latest/Getting-Started-Setup-Environment?UI=MVC&DB=EF&Tiered=Yes
What exactly is being cached in Redis?
-
When you see the
IDistributedCache
interface, it means Redis is required by default. The following modules are already using Redis (some modules are commercial modules):-
setting-management:
SettingManagementStore
for setting values. -
permission-management:
PermissionStore
for granted permissions. -
saas:
TenantDeletedHandler
and TenantStore class -
cms-kit:
UrlShortingPublicAppService
class for Shortened URL Caches -
language-management: DynamicResourceLocalizer class for the Language Text caches
-
file-management:
FileDescriptorAppService
class for the Download Token Cache. -
text-template-management:
DynamicTemplateDefinitionStore
class -
gdpr:
GdprRequestAppService
class for Download Token Cache.
-
Finally, I want you to know that you can replace Redis with any other caching provider like Memcached.
Resources:
-