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

No obvious way to break the cache #3

Closed
calumbrodie opened this issue Jan 5, 2012 · 3 comments
Closed

No obvious way to break the cache #3

calumbrodie opened this issue Jan 5, 2012 · 3 comments

Comments

@calumbrodie
Copy link

It's important to be able to break the cache by

  1. deleting specific entries by key

and

  1. deleting multiple entries by namespace

I can't find any way to do either. Maybe just missing from the documentation?

@beryllium
Copy link
Owner

Sadly, it's not missing from the documentation, it's just not part of the CacheBundle interface definition at the moment. Several useful pecl-memcache calls are missing (delete, add, replace), along with some lesser-used ones (flush, decrement, increment). Many pecl-memcached calls are also not implemented (append, prepend, cas, fetch, and more).

Memcache doesn't appear to have direct support for clearing multiple entries by namespace or wildcard, so a generic interface like this would probably not be able to support that. The memcached documentation suggests a method of emulating namespaces by hand - unfortunately, it requires the "add" function.

I hope to add support for delete, add, and replace in the near future. You're welcome to fork and try making the change and submitting a PR yourself, if you're interested in accelerating the implementation.

@calumbrodie
Copy link
Author

Sorry I was slow to get back to you, and sorry I didn't check the code more closely before asking a stupid question!

Unfortunately I'm not familiar with memcached, but have previously implemented the same feature with APC using APCIterator (http://php.net/manual/en/apciterator.construct.php). This allows you to pass a regex into the constuctor and iterate over cache entries that match the key (deleting them one at a time). Again not ideal, but it is possible. Redis on the other hand though the set data-type (http://redis.io/commands#set) allows this sort of thing easily, and there is a bundle for redis already (https://github.com/snc/SncRedisBundle)

Is there anything in particular that has led you to start your own bundle (not criticizing, I'm just curious) instead of using https://github.com/KnpLabs/KnpZendCacheBundle for example?

edit: and maybe change this issue to a feature request instead

beryllium added a commit that referenced this issue Jul 18, 2012
@beryllium
Copy link
Owner

Item #1 has been addressed in the latest commit, but Item #2 is still pending ... I am going to close this issue as multiple deletes are out-of-scope for this bundle at the moment. If people still find it to be worth investigating, I encourage them to open a feature request :)

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

No branches or pull requests

2 participants