Skip to content

Non-expiring cache keys  #12327

Closed
Closed
@DeathKR

Description

@DeathKR

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

Activity

Jurigag

Jurigag commented on Oct 16, 2016

@Jurigag
Contributor

Because it should be more likely 0.

DeathKR

DeathKR commented on Oct 16, 2016

@DeathKR
Author

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

Jurigag commented on Oct 16, 2016

@Jurigag
Contributor

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

DeathKR

DeathKR commented on Oct 16, 2016

@DeathKR
Author

Sorry, may be for memcached need always store ttl.

self-assigned this
on Oct 16, 2016
added this to the 3.0.3 milestone on Dec 24, 2016
sergeyklay

sergeyklay commented on Dec 24, 2016

@sergeyklay
Contributor

Fixed in the 3.0.x branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

    Participants

    @niden@sergeyklay@Jurigag@DeathKR

    Issue actions

      Non-expiring cache keys · Issue #12327 · phalcon/cphalcon