Skip to content

tweak the cache docs #18710

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
Aug 7, 2023
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
20 changes: 10 additions & 10 deletions cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,19 @@ will create pools with service IDs that follow the pattern ``cache.[type]``.
>
<framework:config>
<!--
default_doctrine_dbal_provider: Service: cache.doctrine_dbal
default_psr6_provider: Service: cache.psr6
default_redis_provider: Service: cache.redis
default_memcached_provider: Service: cache.memcached
default_pdo_provider: Service: cache.pdo
default-doctrine-dbal-provider: Service: cache.doctrine_dbal
default-psr6-provider: Service: cache.psr6
default-redis-provider: Service: cache.redis
default-memcached-provider: Service: cache.memcached
default-pdo-provider: Service: cache.pdo
-->
<!-- "directory" attribute is only used with cache.adapter.filesystem -->
<framework:cache directory="%kernel.cache_dir%/pools"
default_doctrine_dbal_provider="doctrine.dbal.default_connection"
default_psr6_provider="app.my_psr6_service"
default_redis_provider="redis://localhost"
default_memcached_provider="memcached://localhost"
default_pdo_provider="pgsql:host=localhost"
default-doctrine-dbal-provider="doctrine.dbal.default_connection"
default-psr6-provider="app.my_psr6_service"
default-redis-provider="redis://localhost"
default-memcached-provider="memcached://localhost"
default-pdo-provider="pgsql:host=localhost"
/>
</framework:config>
</container>
Expand Down
2 changes: 0 additions & 2 deletions components/cache/adapters/apcu_adapter.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. _apcu-adapter:

APCu Cache Adapter
==================

Expand Down
2 changes: 0 additions & 2 deletions components/cache/adapters/chain_adapter.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. _component-cache-chain-adapter:

Chain Cache Adapter
===================

Expand Down
6 changes: 2 additions & 4 deletions components/cache/adapters/couchbasebucket_adapter.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. _couchbase-adapter:

Couchbase Bucket Cache Adapter
==============================

Expand All @@ -8,8 +6,8 @@ Couchbase Bucket Cache Adapter
The Couchbase Bucket adapter was introduced in Symfony 5.1.

This adapter stores the values in-memory using one (or more) `Couchbase server`_
instances. Unlike the :ref:`APCu adapter <apcu-adapter>`, and similarly to the
:ref:`Memcached adapter <memcached-adapter>`, it is not limited to the current server's
instances. Unlike the :doc:`APCu adapter </components/cache/adapters/apcu_adapter>`, and similarly to the
:doc:`Memcached adapter </components/cache/adapters/memcached_adapter>`, it is not limited to the current server's
shared memory; you can store contents independent of your PHP environment.
The ability to utilize a cluster of servers to provide redundancy and/or fail-over
is also available.
Expand Down
6 changes: 2 additions & 4 deletions components/cache/adapters/couchbasecollection_adapter.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. _couchbase-collection-adapter:

Couchbase Collection Cache Adapter
==================================

Expand All @@ -8,8 +6,8 @@ Couchbase Collection Cache Adapter
The Couchbase Collection adapter was introduced in Symfony 5.4.

This adapter stores the values in-memory using one (or more) `Couchbase server`_
instances. Unlike the :ref:`APCu adapter <apcu-adapter>`, and similarly to the
:ref:`Memcached adapter <memcached-adapter>`, it is not limited to the current server's
instances. Unlike the :doc:`APCu adapter </components/cache/adapters/apcu_adapter>`, and similarly to the
:doc:`Memcached adapter </components/cache/adapters/memcached_adapter>`, it is not limited to the current server's
shared memory; you can store contents independent of your PHP environment.
The ability to utilize a cluster of servers to provide redundancy and/or fail-over
is also available.
Expand Down
2 changes: 0 additions & 2 deletions components/cache/adapters/doctrine_adapter.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. _doctrine-adapter:

Doctrine Cache Adapter
======================

Expand Down
2 changes: 0 additions & 2 deletions components/cache/adapters/doctrine_dbal_adapter.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. _doctrine-dbal-adapter:

Doctrine DBAL Cache Adapter
===========================

Expand Down
11 changes: 5 additions & 6 deletions components/cache/adapters/filesystem_adapter.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
.. _component-cache-filesystem-adapter:

Filesystem Cache Adapter
========================

This adapter offers improved application performance for those who cannot install
tools like :ref:`APCu <apcu-adapter>` or :ref:`Redis <redis-adapter>` in their
tools like :doc:`APCu </components/cache/adapters/apcu_adapter>` or :doc:`Redis </components/cache/adapters/redis_adapter>` in their
environment. It stores the cache item expiration and content as regular files in
a collection of directories on a locally mounted filesystem.

Expand Down Expand Up @@ -39,9 +37,10 @@ and cache root path as constructor parameters::

The overhead of filesystem IO often makes this adapter one of the *slower*
choices. If throughput is paramount, the in-memory adapters
(:ref:`Apcu <apcu-adapter>`, :ref:`Memcached <memcached-adapter>`, and
:ref:`Redis <redis-adapter>`) or the database adapters
(:ref:`Doctrine DBAL <doctrine-dbal-adapter>`, :ref:`PDO <pdo-adapter>`) are recommended.
(:doc:`Apcu </components/cache/adapters/apcu_adapter>`, :doc:`Memcached </components/cache/adapters/memcached_adapter>`,
and :doc:`Redis </components/cache/adapters/redis_adapter>`) or the database adapters
(:doc:`Doctrine DBAL </components/cache/adapters/doctrine_dbal_adapter>`, :doc:`PDO </components/cache/adapters/pdo_adapter>`)
are recommended.

.. note::

Expand Down
6 changes: 2 additions & 4 deletions components/cache/adapters/memcached_adapter.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
.. _memcached-adapter:

Memcached Cache Adapter
=======================

This adapter stores the values in-memory using one (or more) `Memcached server`_
instances. Unlike the :ref:`APCu adapter <apcu-adapter>`, and similarly to the
:ref:`Redis adapter <redis-adapter>`, it is not limited to the current server's
instances. Unlike the :doc:`APCu adapter </components/cache/adapters/apcu_adapter>`, and similarly to the
:doc:`Redis adapter </components/cache/adapters/redis_adapter>`, it is not limited to the current server's
shared memory; you can store contents independent of your PHP environment.
The ability to utilize a cluster of servers to provide redundancy and/or fail-over
is also available.
Expand Down
2 changes: 0 additions & 2 deletions components/cache/adapters/pdo_adapter.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. _pdo-adapter:

PDO Cache Adapter
=================

Expand Down
4 changes: 1 addition & 3 deletions components/cache/adapters/php_files_adapter.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
.. _component-cache-files-adapter:

PHP Files Cache Adapter
=======================

Similarly to :ref:`Filesystem Adapter <component-cache-filesystem-adapter>`, this cache
Similarly to :doc:`Filesystem Adapter </components/cache/adapters/filesystem_adapter>`, this cache
implementation writes cache entries out to disk, but unlike the Filesystem cache adapter,
the PHP Files cache adapter writes and reads back these cache files *as native PHP code*.
For example, caching the value ``['my', 'cached', 'array']`` will write out a cache
Expand Down
6 changes: 2 additions & 4 deletions components/cache/adapters/redis_adapter.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. _redis-adapter:

Redis Cache Adapter
===================

Expand All @@ -12,8 +10,8 @@ Redis Cache Adapter

This adapter stores the values in-memory using one (or more) `Redis server`_ instances.

Unlike the :ref:`APCu adapter <apcu-adapter>`, and similarly to the
:ref:`Memcached adapter <memcached-adapter>`, it is not limited to the current server's
Unlike the :doc:`APCu adapter </components/cache/adapters/apcu_adapter>`, and similarly to the
:doc:`Memcached adapter </components/cache/adapters/memcached_adapter>`, it is not limited to the current server's
shared memory; you can store contents independent of your PHP environment. The ability
to utilize a cluster of servers to provide redundancy and/or fail-over is also available.

Expand Down
14 changes: 7 additions & 7 deletions components/cache/cache_pools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Pruning Cache Items
-------------------

Some cache pools do not include an automated mechanism for pruning expired cache items.
For example, the :ref:`FilesystemAdapter <component-cache-filesystem-adapter>` cache
For example, the :doc:`FilesystemAdapter </components/cache/adapters/filesystem_adapter>` cache
does not remove expired cache items *until an item is explicitly requested and determined to
be expired*, for example, via a call to ``Psr\Cache\CacheItemPoolInterface::getItem``.
Under certain workloads, this can cause stale cache entries to persist well past their
Expand All @@ -202,11 +202,11 @@ expired cache items.
This shortcoming has been solved through the introduction of
:class:`Symfony\\Component\\Cache\\PruneableInterface`, which defines the abstract method
:method:`Symfony\\Component\\Cache\\PruneableInterface::prune`. The
:ref:`ChainAdapter <component-cache-chain-adapter>`,
:ref:`DoctrineDbalAdapter <doctrine-dbal-adapter>`, and
:ref:`FilesystemAdapter <component-cache-filesystem-adapter>`,
:ref:`PdoAdapter <pdo-adapter>`, and
:ref:`PhpFilesAdapter <component-cache-files-adapter>` all implement this new interface,
:doc:`ChainAdapter </components/cache/adapters/chain_adapter>`,
:doc:`DoctrineDbalAdapter </components/cache/adapters/doctrine_dbal_adapter>`, and
:doc:`FilesystemAdapter </components/cache/adapters/filesystem_adapter>`,
:doc:`PdoAdapter </components/cache/adapters/pdo_adapter>`, and
:doc:`PhpFilesAdapter </components/cache/adapters/php_files_adapter>` all implement this new interface,
allowing manual removal of stale cache items::

use Symfony\Component\Cache\Adapter\FilesystemAdapter;
Expand All @@ -215,7 +215,7 @@ allowing manual removal of stale cache items::
// ... do some set and get operations
$cache->prune();

The :ref:`ChainAdapter <component-cache-chain-adapter>` implementation does not directly
The :doc:`ChainAdapter </components/cache/adapters/chain_adapter>` implementation does not directly
contain any pruning logic itself. Instead, when calling the chain adapter's
:method:`Symfony\\Component\\Cache\\Adapter\\ChainAdapter::prune` method, the call is delegated to all
its compatible cache adapters (and those that do not implement ``PruneableInterface`` are
Expand Down