A general caveat is that using this adapter reserves any cache key starting with '__tag.'. Using the same pool is precarious if your cache does LRU evictions of items even if they do not expire (as in e.g. memcached). If so, the tag item may be evicted without all of the tagged items having been evicted first, causing items to lose their tags. In order to mitigate this issue, you may use a separate, more persistent pool for your tag items. Do however note that if you are doing so, the entire pool is reserved for tags, as this pool is cleared whenever the main pool is cleared.
Author: Magnus Nordlander (magnus@fervo.se)
Inheritance: implements Cache\Taggable\TaggablePoolInterface, use trait TaggablePoolTrait
 /**
  * @param CacheItemPoolInterface $pool
  * @param array                  $config
  *
  * @return Psr6SessionHandler
  */
 public static function get(CacheItemPoolInterface $pool, $config)
 {
     if ($config['use_tagging']) {
         $pool = new FixedTaggingCachePool(TaggablePSR6PoolAdapter::makeTaggable($pool), ['session']);
     }
     return new Psr6SessionHandler($pool, $config);
 }
 /**
  * @param CacheItemPoolInterface $pool
  * @param array                  $config
  *
  * @return SymfonyValidatorBridge
  */
 public static function get(CacheItemPoolInterface $pool, $config)
 {
     if ($config['use_tagging']) {
         $pool = new FixedTaggingCachePool(TaggablePSR6PoolAdapter::makeTaggable($pool), ['validation']);
     }
     return new SymfonyValidatorBridge($pool);
 }
 /**
  * @param CacheItemPoolInterface $pool
  * @param array                  $config
  * @param array                  $tags
  *
  * @return DoctrineCacheBridge
  */
 public static function get(CacheItemPoolInterface $pool, $config, array $tags)
 {
     if ($config['use_tagging']) {
         $pool = new FixedTaggingCachePool(TaggablePSR6PoolAdapter::makeTaggable($pool), $tags);
     }
     return new DoctrineCacheBridge($pool);
 }
 public function createCachePool()
 {
     return TaggablePSR6PoolAdapter::makeTaggable(new SymfonyArrayAdapter());
 }
Esempio n. 5
0
 /**
  * Creates and returns an instance of Taggable Cache Pool type specified by adapter name.
  *
  * @param string $adapterName The name of the adapter to use
  *
  * @return \Cache\Taggable\TaggablePoolInterface
  */
 public function makeTaggable($adapterName)
 {
     return TaggablePSR6PoolAdapter::makeTaggable($this->make($adapterName));
 }
Esempio n. 6
0
 /**
  * 
  */
 public function flushCache()
 {
     $this->cache->clearTags(['weather']);
 }