@@ -10,20 +10,22 @@ change in the state of your model. The most basic kind of invalidation is direct
1010items deletion. But when the state of a primary resource has spread accross
1111several cached items, keeping them in sync can be difficult.
1212
13- The Symfony Cache component provides two mechanisms to helpsolve this problem:
13+ The Symfony Cache component provides two mechanisms to helpsolving this problem:
1414
15- * Tags based invalidation for managing data dependencies;
16- * Expiration based invalidation for time related dependencies.
15+ *:ref: ` Tags based invalidation < cache-component-tags >` for managing data dependencies;
16+ *:ref: ` Expiration based invalidation < cache-component-expiration >` for time related dependencies.
1717
18- ..versionadded ::3.2
19- Tags based invalidation was introduced in Symfony 3.2.
18+ .. _cache-component-tags :
2019
2120Using Cache Tags
2221----------------
2322
23+ ..versionadded ::3.2
24+ Tags based invalidation was introduced in Symfony 3.2.
25+
2426To benefit from tags based invalidation, you need to attach the proper tags to
25- each cacheditems . Each tag is a plain string identifier that you can use at any
26- time to trigger the removal of all items thathad this tag attached to them.
27+ each cacheditem . Each tag is a plain string identifier that you can use at any
28+ time to trigger the removal of all items thathave this tag attached to them.
2729
2830To attach tags to cached items, you need to use the
2931:method: `Symfony\\ Component\\ Cache\\ CacheItem::tag ` method that is implemented by
@@ -36,17 +38,14 @@ cache items, as returned by cache adapters::
3638 $item->tag(array('tag_2', 'tag_3'));
3739 $cache->save($item);
3840
39- If ``$cache `` implements:class: `Symfony\\ Component\\ Cache\\ TagAwareAdapterInterface `,
41+ If ``$cache `` implements:class: `Symfony\\ Component\\ Cache\\ Adapter \\ TagAwareAdapterInterface `,
4042you can invalidate the cached items by calling
41- :method: `Symfony\\ Component\\ Cache\\ TagAwareAdapterInterface::invalidateTags `::
42-
43- // invalidate all items related to `tag_2`
44- $cache->invalidateTags('tag_2');
43+ :method: `Symfony\\ Component\\ Cache\\ Adapter\\ TagAwareAdapterInterface::invalidateTags `::
4544
46- //or invalidate all items related to `tag_1` or `tag_3`
45+ // invalidate all items related to `tag_1` or `tag_3`
4746 $cache->invalidateTags(array('tag_1', 'tag_3'));
4847
49- // if you know the cache key, you can of course delete directly
48+ // if you know the cache key, you can of course deletethe item directly
5049 $cache->deleteItem('cache_key');
5150
5251Using tags invalidation is very useful when tracking cache keys becomes difficult.
@@ -81,6 +80,8 @@ your fronts and have very fast invalidation checks::
8180 new RedisAdapter('redis://localhost')
8281 );
8382
83+ .. _cache-component-expiration :
84+
8485Using Cache Expiration
8586----------------------
8687