-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure all types of cache supports prefix and tagging (#71)
* Make sure all types of cache supports prefix and tagging * Make sure we do not use old tagging * cs * bugfix
- Loading branch information
Showing
8 changed files
with
67 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of php-cache\cache-bundle package. | ||
* | ||
* (c) 2015-2015 Aaron Scherer <[email protected]>, Tobias Nyholm <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Cache\CacheBundle\Factory; | ||
|
||
use Cache\CacheBundle\Routing\CachingRouter; | ||
use Cache\Prefixed\PrefixedCachePool; | ||
use Cache\Taggable\TaggablePSR6PoolAdapter; | ||
use Psr\Cache\CacheItemPoolInterface; | ||
use Symfony\Component\Routing\RouterInterface; | ||
|
||
/** | ||
* @author Tobias Nyholm <[email protected]> | ||
*/ | ||
class RouterFactory | ||
{ | ||
/** | ||
* @param CacheItemPoolInterface $pool | ||
* @param RouterInterface $router | ||
* @param array $config | ||
* | ||
* @return CachingRouter | ||
*/ | ||
public static function get(CacheItemPoolInterface $pool, RouterInterface $router, array $config) | ||
{ | ||
if ($config['use_tagging']) { | ||
$pool = TaggablePSR6PoolAdapter::makeTaggable($pool); | ||
} | ||
|
||
if (!empty($config['prefix'])) { | ||
$pool = new PrefixedCachePool($pool, $config['prefix']); | ||
} | ||
|
||
return new CachingRouter($pool, $router, $config); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters