this is what you need.
MULTI
SOME OP AGAINST KEY
TTL KEY
EXEC
basically send every command as a Redis transaction including the
final TTL command against the key and you are done.
Cheers,
Salvatore
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
>
>
--
Salvatore 'antirez' Sanfilippo
open source developer - VMware
http://invece.org
"We are what we repeatedly do. Excellence, therefore, is not an act,
but a habit." -- Aristotele
Marc
Also note that the ability to use EXPIRE on a key that already has expiry depends on the redis version.
We use something like this to spoof sliding expiration - although we embed data is the value and handle it in our wrapper layer, reissuing an EXPIRE or SETEX as necessary.
However - I'd happily add a +1 to anybody proposal to include sliding expiry at the server layer.
Marc
On 14 Aug 2011, at 10:38, Salvatore Sanfilippo <ant...@gmail.com> wrote:
The idea is to atomically extend the TTL of the key. As Marc
mentioned, it is not TTL but EXPIRE that should be called with a new
TTL that should overwrite the old one. It is important to wrap this in
a MULTI/EXEC block IFF you want EVERY update to extend the TTL. If
this is not a hard requirement you can just perform the operation and
call EXPIRE without a MULTI/EXEC.
If you find the documentation lacking, I invite you to make the edits
you deem fit in the repository at http://github.com/antirez/redis-doc,
and send a pull request. When necessary, we can continue discussing
the modifications there.
Thanks,
Pieter