Open Closed

Can I use a cache other than Redis? #8411


User avatar
0
Teknosol created
  • ABP Framework version: v7.1.1
  • UI Type: Angular
  • Database System: EF Core ( PostgreSQL,..)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

Is it possible to replace the redis cache used in our abp project with another brand (memcache, ehcache, hazelcache)?

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

7 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Yes. You can use other distributed cache to replace the Redis

    https://learn.microsoft.com/en-us/aspnet/core/performance/caching/distributed?view=aspnetcore-9.0

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    Teknosol created

    Thanks for your answer There is a line on this page about using Memcached. Is there an example of its implementation?

    https://abp.io/support/questions/6344/Why-do-we-need-to-install-Redis-When-is-it-used-Why-Redis-is-needed

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can use a class library that implements the IDistributedCache eg https://github.com/cnblogs/EnyimMemcachedCore

    Then, use it in the abp application. the abp's cache will be replaced with yours

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    Teknosol created

    Thanks for your answer but could not be solved.

    As you can see in the image above, you have a module for redis, do you also have a module for memcache?

    In the picture below, I manage permissions by performing a remote service. This class also uses cache. How should I proceed to transfer this to memcache?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Add EnyimMemcachedCore package to your ApiHostModule.

    Remove the AbpCachingStackExchangeRedisModule and call context.Services.AddEnyimMemcached();

    The ABP's IDistributedCache<> will use the Memcached

    Remember to configure your cache.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    Teknosol created

    In the solution you mentioned it continues to work in memory. Don't I need such a configuration to convert it to Memcache? :

    context.Services.AddSingleton<IDistributedCache<"ApplicationConfigurationDto">, Definition.Caching.MemcachedCache>();

    this picture shows where I used cache.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Sorry for that. Please add the code below.

    context.Services.RemoveAll(x => x.ServiceType == typeof(IDistributedCache));
    context.Services.AddEnyimMemcached(asDistributedCache: true);
    

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 28, 2026, 11:44
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.