New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why the backend cache redis add the special key(statsKey) _PHCR #10905

lixiphp opened this Issue Sep 8, 2015 · 2 comments


None yet
2 participants
Copy link

lixiphp commented Sep 8, 2015

when the cache is expired, the key still exists in statsKey _PHCR, why design this sepcial key store all the index keys?


This comment has been minimized.

Copy link

Green-Cat commented Sep 8, 2015

It exists to be able to flush the Redis cache from phalcon. It is disabled by default in the 2.0.x branch now though.


This comment has been minimized.

Copy link

lixiphp commented Sep 8, 2015

@Green-Cat it is a good idea. So flushing cache can realize via PHP code not impacted by KV Redis.

@lixiphp lixiphp closed this Sep 8, 2015

This was referenced Nov 12, 2015

pantaovay added a commit to pantaovay/cphalcon that referenced this issue Mar 30, 2016

Modify cache redis backend
# Changes

1. Modify cache redis backend, delete _PHCR
2. Cache redis backend supports "client" option, now you can pass a redis client

# Why

1. The redis cache backend use a special key _PHCR to store all keys used by cache. There is a issue: phalcon#10905 .According to @Green-Cat ,it is disabled in 2.0.x branch which is not true. If use _PHCR, every time we set a cache, we have to run sAdd and set commands. Store all keys in _PHCR will cause it expands quickly and this will influence performance.
2. The previous implementation mixes statsKey and prefix, it uses _PHCR as super prefix which is not needed.
3. The cache backend doesn't support redis option which means that we can not pass a redis connection. So if we use modelsCache and modelsMetadata, there will be two redis connections. So I modify this part and let redis option be supported, and through the lifetime of a request we can use one redis connection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment