debop / hibernate-redis

hibernate 2nd level cache privder using redis
Apache License 2.0
357 stars 184 forks source link

Support to another strategy of cache expiration. #30

Closed dyorgio closed 8 years ago

dyorgio commented 9 years ago

Maybe this library can support another type of expiration strategy:

Today: Daemon cleaning Thread. Z scored set put on user put. Z verification ou user get.

Proposal: Store values with 8 bytes long prefix (expiration date) metadata. When user gets value, verify expiration metadata first. If expired, return null and send a delete command in background, if not return object. Define expiration of Hash to redis using command EXPIRE every time then a user put values to region Redis will clean entire Hash if anybody put new values (daybreak)

The idea is mantain both, and let user choose.

jonspalmer commented 8 years ago

I like it. Eliminating the cleaning thread would be nice. Happy to accept a Pull Request over in our fork that we intent to maintain and release from: https://github.com/hibernate-redis/hibernate-redis/

dyorgio commented 8 years ago

:(, sorry, it is in a private repository. If I use this lib again I will do it!

debop commented 8 years ago

hiberate-redis 2.0.0 use Redisson library which has expiring logic by Lua.