Open Closed

Volo.Abp.Caching.StackExchangeRedis Alternative #4733


User avatar
0
ndeol created
  • ABP Framework version: v7.0.3 Microservices
  • UI type: Angular
  • DB provider: MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Is it possible to remove Volo.Abp.Caching.StackExchangeRedis from microservices solution or any alternative implementations?. I have Implemented MondoDb cache for IDistributed cache but it seems like all core module use this package to cache all data.


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

    hi

    This is possible. You can remove all Volo.Abp.Caching.StackExchangeRedis packages and AbpCachingStackExchangeRedisModule from Microservices project.

    Remove:

    using Volo.Abp.Caching.StackExchangeRedis;
    
            context.Services.AddSingleton<IDistributedLockProvider>(_ =>
                new RedisDistributedSynchronizationProvider(redis.GetDatabase()));
    
    
  • User Avatar
    0
    ndeol created

    What will be the impact If i remove all references and run multiple instance of same service. I can use azure blob storage for distributed locking.?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    . I have Implemented MondoDb cache for IDistributed cache but it seems like all core module use this package to cache all data.

    You can replace this with your implementation

  • User Avatar
    0
    ndeol created

    Do I have replace all Child Modules Code as well ? O just replace IDistributedCache Implementation ?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You only need to replace them in your Microservices project.

  • User Avatar
    0
    ndeol created

    It seems like when I disable cache . Its still using local cache for each microservice ? PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:Saas.Editions [13:11:59 DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:Saas.Tenants [13:11:59 DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:Saas.Editions [13:11:59 DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:Saas.Tenants [13:11:59 DBG] Found in the cache: pn:R,pk:admin,n:Saas.Tenants [13:11:59 DBG] Found in the cache: pn:R,pk:admin,n:Saas.Editions [13:11:59 DBG] Found in the cache: pn:R,pk:admin,n:Saas.Tenants [13:11:59 DBG] Found in the cache: pn:R,pk:admin,n:Saas.Editions [13:11:59 DBG] PermissionStore.GetCacheItemAsync: pn:C,pk:WpayConnect_Angular,n:Saas.Editions [13:11:59 DBG] PermissionStore.GetCacheItemAsync: pn:C,pk:WpayConnect_Angular,n:Saas.Editions [13:11:59 DBG] PermissionStore.GetCacheItemAsync: pn:C,pk:WpayConnect_Angular,n:Saas.Tenants [13:11:59 DBG] Found in the cache: pn:C,pk:WpayConnect_Angular,n:Saas.Editions [13:11:59 DBG] PermissionStore.GetCacheItemAsync: pn:C,pk:WpayConnect_Angular,n:Saas.Tenants [13:11:59 DBG] Found in the cache: pn:C,pk:WpayConnect_Angular,n:Saas.Editions [13:11:59 DBG] Found in the cache: pn:C,pk:WpayConnect_Angular,n:Saas.Tenants [13:11:59 DBG] Found in the cache: pn:C,pk:WpayConnect_Angular,n:Saas.Tenants

    Above logs from dotnet when no Redis or Mongo cache enabled ? Can you please confirm that's the case ?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The MemoryCache will work after disabling the Redis.

    context.Services.AddMemoryCache();
    context.Services.AddDistributedMemoryCache();
    
Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15