Skip to content

Commit 1333820

Browse files
committed
feature #14495 [Cache] Adds mention of using FileSystemTagAwareAdatpter (andrerom)
This PR was squashed before being merged into the 4.4 branch. Discussion ---------- [Cache] Adds mention of using FileSystemTagAwareAdatpter As mention of RedisTagAwareAdapter was added in 83fe3d7, this should potentially be enough to fix #12446 Commits ------- 24312cb [Cache] Adds mention of using FileSystemTagAwareAdatpter
2 parents 22312d3 + 24312cb commit 1333820

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

components/cache/adapters/filesystem_adapter.rst

+13
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,18 @@ and cache root path as constructor parameters::
5555
:ref:`pruning of expired cache items <component-cache-cache-pool-prune>` by
5656
calling its ``prune()`` method.
5757

58+
59+
.. _filesystem-tag-aware-adapter:
60+
61+
Working with Tags
62+
-----------------
63+
64+
In order to use tag-based invalidation, you can wrap your adapter in :class:`Symfony\\Component\\Cache\\Adapter\\TagAwareAdapter`, but it's often more interesting to use the dedicated :class:`Symfony\\Component\\Cache\\Adapter\\FilesystemTagAwareAdapter`. Since tag invalidation logic is implemented using links on filesystem, this adapter offers better read performance when using tag-based invalidation::
65+
66+
use Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter;
67+
68+
$cache = new FilesystemTagAwareAdapter();
69+
70+
5871
.. _`tmpfs`: https://wiki.archlinux.org/index.php/tmpfs
5972
.. _`RAM disk solutions`: https://en.wikipedia.org/wiki/List_of_RAM_drive_software

components/cache/cache_invalidation.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ method.
6161
.. note::
6262

6363
When using a Redis backend, consider using :ref:`RedisTagAwareAdapter <redis-tag-aware-adapter>`
64-
which is optimized for this purpose.
64+
which is optimized for this purpose. When using File system, likewise consider to use
65+
:ref:`FilesystemTagAwareAdapter <filesystem-tag-aware-adapter>`.
6566

6667
The :class:`Symfony\\Component\\Cache\\Adapter\\TagAwareAdapter` class implements
6768
instantaneous invalidation (time complexity is ``O(N)`` where ``N`` is the number

0 commit comments

Comments
 (0)