The sfCacheTaggingPlugin is a Symfony plugin, that helps to keep cached
content up-to-date without setting cache lifetime.
So-called "Smart caching", stores cache with fetched models tags and its versions.
Each time you save/update/delete objects, plugin increments object tag version and
all linked cache by specific tag name will automatically spoil.

The sfCacheTaggingPlugin is a Symfony plugin, that helps to store cache with
associated tags and to keep cache content up-to-date based by incrementing tag
version when cache objects are edited/removed or new objects are ready to be a
part of cache content.

Developers

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTIONOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Release 1.0.1 - 18/12/2009

Release 1.0.0 - 16/12/2009

Release 0.1.0 - 16/12/2009

sfCacheTaggingPlugin

The sfCacheTaggingPlugin is a Symfony plugin, that helps to store cache with
associated tags and to keep cache content up-to-date based by incrementing tag
version when cache objects are edited/removed or new objects are ready to be a
part of cache content.

This software was developed inspired by Andrey Smirnoff's theoretical work
"Cache tagging with Memcached (on Russian)".
Some ideas are implemented in the real world (e.i. tag versions based on datetime
and micro time, cache hit/set logging, cache locking) and part of them
are not (atomic counter).

How to cache private blocks (actions/pages/partials) for authenticated users

Symfony's cache mechanism creates the unique key to each block you want to cache based on
following arguments:

- Module name
- Action name
- $_GET arguments

In case you would like to cache user's private data you must be very careful.
To prevent users of seeing other user private data you need to add
additional parameter to distinguish cached blocks among other private blocks.

The easiest way is to keep user_id/username in URL, but it's awful.
I suggest to add custom $_GET parameter on the fly. This will
prevent of showing "user_id" in URL.

What should you do is to register a new filter AuthParamFilter and switch standard
sfWebRequest with plugin's one sfCacheTaggingWebRequest.

Place AuthParamFilter before "caching" filter in apps/%application_name%/config/filters.yml

Restrictions: Backend's class should be inherited from sfCache
class. Then, it should be implement sfTaggingCacheInterface
(due to a Doctrine cache engine compatibility).
Also, it should support the caching of objects and/or arrays.

Therefor, plugin comes with additional extended backend classes:

sfAPCTaggingCache

sfEAcceleratorTaggingCache

sfFileTaggingCache

sfMemcacheTaggingCache

sfSQLiteTaggingCache

sfXCacheTaggingCache

And bonus one:

sfSQLitePDOTaggingCache (based on stand alone sfSQLitePDOCache)

Adding "Cachetaggable" behavior to the models

Two major setups to pay attention:

Model setup

When object tag will be invalidated

How object tag will stored (tag naming)

Relation setup

What will happen with related objects in case root-object is deleted or updated