killme2008 / xmemcached

High performance, easy to use multithreaded memcached client in java.
http://fnil.net/xmemcached
Apache License 2.0
755 stars 280 forks source link

Is `incr()` supposed to update expiry time? #111

Closed stv8 closed 4 years ago

stv8 commented 4 years ago

I've noticed that calling incr() with an an expiry such as

memcachedClient.incr("derp", 1, 1, 5000, 30)

will set an initial expiry, but subsequent calls to incr() with an expiry will not update the expiry and the key expires according to the initial expiry. I followed the execution flow in my debugger and found that the expiry is being sent every time, but maybe I am misunderstanding if memcached even supports updating an expiry.

With that said, is not updating expiry with subsequent calls intended behavior or a bug?

Thanks!

References: http://fnil.net/docs/xmemcached/net/rubyeye/xmemcached/MemcachedClient.html#incr(java.lang.String,%20long,%20long,%20long,%20int)

long incr(String key,
        long delta,
        long initValue,
        long timeout,
        int exp)
          throws TimeoutException,
                 InterruptedException,
                 MemcachedException
killme2008 commented 4 years ago

Memcached doesn't support updating expiry with subsequent calls. You can use touch(key, expires) instead.

stv8 commented 4 years ago

Thanks for the follow up!