[hibernate-dev] Redis and TTL

Guillaume Smet guillaume.smet at gmail.com
Mon Jun 27 08:43:25 EDT 2016


So, I'm currently working on reducing the number of calls issued to Redis
in OGM as part of OGM-1064.

At the moment, we execute a call to Redis to get the TTL already configured
on an object before saving it. If the TTL is not explicitly configured with
@TTL, we set this TTL again after having stored this entity (see
RedisJsonDialect#storeEntity). Same for associations stored in a different

In fact, this call returns the time remaining before expiration, not the
TTL previously configured,  so I find this behavior quite weird. Basically,
we store information which will expire sooner than expected. I can't really
get a use case for this and I don't think we should have an additional call
every time we store an object for a so obscure thing. Do we really expect
people to mess with TTLs of objects stored by OGM without relying on OGM
@TTL management?

IMHO, we should get rid of this call and only deal with TTL when it's
configured via the @TTL annotation.



More information about the hibernate-dev mailing list