Reputation: 682
So when I set a value to be cached and I want to increment the value it resets the expiration time?
To test it I've set a value and expiration to 1 minute. Then I used increment every second until 1 minute and it didn't expire.
How can I increment without resetting the expiration time?
$app->cache->put($requestCache . '_Minute', 0, 1); // value 0, expire in 1 minute
$app->cache->increment($requestCache . '_Minute'); // doing this resets the 1 minute expire time
Upvotes: 1
Views: 3597
Reputation: 839
If you are using "predis/predis" package
$storage=Redis::connection();
$storage->zIncrBy("",1,$key)
Upvotes: 0
Reputation: 29
If cache driver is Redis. The code is work
$app->cache->put($key, $app->cache->increment($key), 1)
Upvotes: 1