Skip to content

[Cache] Adds mention of using FileSystemTagAwareAdatpter #14495

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

Merged
merged 1 commit into from
Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions components/cache/adapters/filesystem_adapter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,18 @@ and cache root path as constructor parameters::
:ref:`pruning of expired cache items <component-cache-cache-pool-prune>` by
calling its ``prune()`` method.


.. _filesystem-tag-aware-adapter:

Working with Tags
-----------------

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::

use Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter;

$cache = new FilesystemTagAwareAdapter();


.. _`tmpfs`: https://wiki.archlinux.org/index.php/tmpfs
.. _`RAM disk solutions`: https://en.wikipedia.org/wiki/List_of_RAM_drive_software
3 changes: 2 additions & 1 deletion components/cache/cache_invalidation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ method.
.. note::

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

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