On 25/11/2016 11:21, Rasmus Schultz wrote:
Assuming I understand the concept correctly, I would *not* expect a
cache-instance to flush the entire server, but rather to flush only the
collection represented by the cache-instance.

Doctrine's cache-abstraction includes the concept of "namespaces", which
equate to collection IDs - but here the distinction is clear, since it
includes two distinct methods for clearing a collection with deleteAll()
vs clearing the entire server with flush().

With PSR-16, there is only method, flush(), so it's extremely important
we understand what precisely the scope of a cache-instance is: a entire
server, or a collection on a server?

As I understand what you said, PSR-16 represents a cache server, and flush() would wipe everything on there. The reason IMO is that clearing the namespace is very inefficient as if the cache backend doesn't have a concept of namespacing you are forced to iterate over all keys, or keep track of all keys you write.

I would generally not expect a library I give a Cache to to call flush(), because that's kinda crazy for most things if you wanna do invalidation you do it per item you don't blow the whole cache, or at least that should be an application developer decision..

What I typically do is defining multiple cache instances using redis databases for "namespacing", so that the keys can not possibly conflict, and flushing one db doesn't impact any other db. That is maybe not possible with Memcached, I have no idea.

Cheers

--
Jordi Boggiano
@seldaek - http://seld.be

--
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/aa6d9626-a60e-74dc-5712-421779f0c021%40seld.be.
For more options, visit https://groups.google.com/d/optout.

Reply via email to