Update an existing value in cache causes the expire time (TTL) to be reset
aliomar658 opened this issue · 1 comments
Hi,
When setting a new value in cache with specific expire time (TTL) then trying to update the existing value using one of the methods ( Increment, Decrement, REPLACE ) the expire time (TTL) will get overridden and set to 0 ( which is infinite ) and this is so problematic as in some cases I need to update existing cache values without edit or touch their expire time.
Until now I verified this problem on three adapters ( Flysystem, SQLite, APC )
Code Example:
$cache->set( 'test-issue', 5, 3600 );
$cache->increment( 'test'issue' );
OR $cache->decrement( 'test-issue' );
Expected Result:
The 'test-issue' value only should be updated without any change to expire time
Actual Result:
The 'test-issue' value updated and expire time changed to 0 ( which makes the value endless )
Thanks.
This is intentional. When called without explicit expiration, it defaults to 0
(or indefinite). This is intentional because some clients (e.g. Memcached) simply don't allow setting new values without touching the existing expiration.