Open Closed

Redis key is too long #6479


User avatar
0
dev@veek.vn created

Hello,

I have saved data to Redis using IDistributedCache, but the key in Redis is excessively long. How can I configure the prefix of the key?

Thanks, Veek

ABP Framework version: v.7.3.2 UI Type: Angular Database System: MongoDB Tiered (for MVC) or Auth Server Separated (for Angular): yes Exception message and full stack trace: Steps to reproduce the issue:


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

    hi

    try to use CacheName on your cache item class.

    using Volo.Abp.Caching;
    
    namespace MyProject
    {
        [CacheName("Books")]
        public class BookCacheItem
        {
            public string Name { get; set; }
    
            public float Price { get; set; }
        }
    }
    
  • User Avatar
    0
    dev@veek.vn created

    got that for class.

    not sure for case string or list string. ex: private readonly IDistributedCache<Queue<string>, string> _cache;

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can create a class to wrap Queue. : )

  • User Avatar
    0
    dev@veek.vn created

    ok :))

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09