Non-expiring cache keys #12327

Closed
DeathKR opened this Issue Oct 16, 2016 · 5 comments

Projects

None yet

3 participants

@DeathKR
DeathKR commented Oct 16, 2016 edited

Can't set a non-expiring keys in Redis. Lifetime =-1 does not help.

Expected and Actual Behavior

Phalcon always send to redis EXPIRE command:
1476660660.879090 [0 127.0.0.1:58788] "EXPIRE" "_PHCRmykey" "-1"

$frontCache = new FrontData(['lifetime' => -1]);

$cache = new Redis($frontCache, [
            'host' => 'localhost',
            'port' => 6379,
            'persistent' => true,
            'index' => 0
        ]);

$cache->save("mykey", 1000);

Always set expire to 1 second:

$frontCache = new FrontData();

Also this does not help

$cache->save("mykey", 1000, -1);

Details

  • Phalcon version: 3.0.1
  • PHP Version: PHP 7.0.11-1~dotdeb+8.1 (cli) ( NTS )
  • Operating System: Debian
  • Installation type: Compiling from source
  • Zephir version (if any): Version 0.9.4a-dev-7e304ba18c
  • Server: Nginx
@Jurigag
Contributor
Jurigag commented Oct 16, 2016

Because it should be more likely 0.

@DeathKR
DeathKR commented Oct 16, 2016

With '0' keys expire at once. I can set 10 years, but it's not solution. I dont't want to Redis was constantly checking the keys that should be always. This is unnecessary CPU operation.

@Jurigag
Contributor
Jurigag commented Oct 16, 2016

I checked and saving in memcache with lifetime 0 works fine.

@DeathKR
DeathKR commented Oct 16, 2016

Sorry, may be for memcached need always store ttl.

@sergeyklay sergeyklay self-assigned this Oct 16, 2016
@sergeyklay sergeyklay added this to the 3.0.3 milestone Dec 24, 2016
@sergeyklay sergeyklay referenced this issue Dec 24, 2016
Merged

Fixed Cache\Backend\Redis::save #12502

3 of 3 tasks complete
@sergeyklay
Collaborator

Fixed in the 3.0.x branch.

@sergeyklay sergeyklay closed this Dec 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment