@@ -41,6 +41,10 @@ drivers do the raw interaction with the cache implementation and
4141the ``AbstractCache `` can build custom functionality on top of
4242these methods.
4343
44+ This documentation does not cover every single cache driver included
45+ with Doctrine. For an up-to-date-list, see the
46+ `cache directory on GitHub <https://github.com/doctrine/cache/tree/master/lib/Doctrine/Common/Cache> `.
47+
4448APC
4549~~~
4650
@@ -401,6 +405,39 @@ To clear the result cache use the ``orm:clear-cache:result`` task.
401405 All these tasks accept a ``--flush `` option to flush the entire
402406contents of the cache instead of invalidating the entries.
403407
408+ Cache Chaining
409+ --------------
410+
411+ A common pattern is to use a static cache to store data that is
412+ requested many times in a single PHP request. Even though this data
413+ may be stored in a fast memory cache, often that cache is over a
414+ network link leading to sizable network traffic.
415+
416+ The ChainCache class allows multiple caches to be registered at once.
417+ For example, a per-request ArrayCache can be used first, followed by
418+ a (relatively) slower MemcacheCache if the ArrayCache misses.
419+ ChainCache automatically handles pushing data up to faster caches in
420+ the chain and clearing data in the entire stack when it is deleted.
421+
422+ A ChainCache takes a simple array of CacheProviders in the order that
423+ they should be used.
424+
425+ .. code-block :: php
426+
427+ $arrayCache = new \Doctrine\Common\Cache\ArrayCache();
428+ $memcache = new Memcache();
429+ $memcache->connect('memcache_host', 11211);
430+ $chainCache = new \Doctrine\Common\Cache\ChainCache([
431+ $arrayCache,
432+ $memcache,
433+ ]);
434+
435+ ChainCache itself extends the CacheProvider interface, so it is
436+ possible to create chains of chains. While this may seem like an easy
437+ way to build a simple high-availability cache, ChainCache does not
438+ implement any exception handling so using it as a high-availability
439+ mechanism is not recommended.
440+
404441Cache Slams
405442-----------
406443
0 commit comments