Ends in:
2 DAYS
4 HRS
19 MIN
21 SEC
Ends in:
2 D
4 H
19 M
21 S
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)?


6 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

  • 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

  • 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

  • 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?

  • 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.

  • 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.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 02, 2024, 12:35