Skip to content
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

Cache flush removes all items #12153

Closed
bkirova opened this issue Aug 18, 2016 · 4 comments
Closed

Cache flush removes all items #12153

bkirova opened this issue Aug 18, 2016 · 4 comments
Assignees
Labels
bug A bug report status: medium Medium
Milestone

Comments

@bkirova
Copy link

bkirova commented Aug 18, 2016

The flush function in Phalcon\Cache\Backend\Apc removes all elements in apc even if there are items with a different prefix.

Phalcon Code :

for item in iterator(new \APCIterator("user")) {
     apc_delete(item["key"]);
}

It would be nice if a single instance of the cache removes only it's own keys by prefix or at least if there was an optional parameter prefix that select the elements with that prefix and removes only those.

Possible usage of the prefix variable

        public function flush() -> boolean
        {
            var item, prefixPattern;

            let prefixPattern = "/^_PHCA" . this->_prefix . "/";

            for item in iterator(new \APCIterator("user", prefixPattern)) {
                apc_delete(item["key"]);
            }

            return true;
        }
@Jurigag
Copy link
Contributor

Jurigag commented Aug 18, 2016

Well in 3.1.0 there will be added APCu backends, so maybe add this too then @sergeyklay ?

@sergeyklay
Copy link
Contributor

@Jurigag This might be fixed with preserving backward compatibility

@sergeyklay
Copy link
Contributor

@bkirova I'll fix it ASAP

@sergeyklay
Copy link
Contributor

Fixed in the 3.0.x branch.

git clone git@github.com:phalcon/cphalcon.git
cd cphalcon
git checkout 3.0.x

zephir fullclean
zephir build

@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

4 participants