Prerequisites
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
- What is your product version? Zero V9.1.0 the latest
- What is your product type (Angular or MVC)? Angular
- What is product framework type (.net framework or .net core)? .Net Core
If issue related with ABP Framework
- What is ABP Framework version? Zero
Hi there,
I am trying to use Redis to implement "recently viewed items" functionality. By reading the zero documentatoin, the cache is expired in 60 minutes by default although i can change the the expiry span to more hours. If the whole cache is expired then all the items within the cache will be expired, but for the "recently viewed items" functionality, i just need to expire the item with least score not the entire cache, please advise if my understanding is correct on the cache implemtation provided by Zero, if i am correct, then would you be able to provide some advise on how i should impliment the " recently viewed items" by leveraging Redis within Zero? Many thanks Laurie
1 Answer(s)
-
0
Hi lweng567, ABP uses the String type provided by Redis for storage. If you want to achieve the expiration of a specific cache item, you can use SortedSet to store these items, use score to store unix time, and the program periodically uses ZRANGEBYSCORE to clear data items.
Reference: https://stackoverflow.com/questions/16545321/how-to-expire-the-hset-child-key-in-redis https://stackoverflow.com/questions/48044721/redis-list-with-expiring-entries