[Cache] Remove TaggableCacheInterface, alias cache.app.taggable to CacheInterface
This commit is contained in:
parent
f557f943ba
commit
c250fbdda0
@ -126,9 +126,8 @@
|
|||||||
<service id="cache.global_clearer" parent="cache.default_clearer" public="true" />
|
<service id="cache.global_clearer" parent="cache.default_clearer" public="true" />
|
||||||
<service id="cache.app_clearer" alias="cache.default_clearer" public="true" />
|
<service id="cache.app_clearer" alias="cache.default_clearer" public="true" />
|
||||||
<service id="Psr\Cache\CacheItemPoolInterface" alias="cache.app" />
|
<service id="Psr\Cache\CacheItemPoolInterface" alias="cache.app" />
|
||||||
<service id="Symfony\Component\Cache\TaggableCacheInterface" alias="cache.app.taggable" />
|
|
||||||
<service id="Psr\SimpleCache\CacheInterface" alias="cache.app.simple" />
|
<service id="Psr\SimpleCache\CacheInterface" alias="cache.app.simple" />
|
||||||
<service id="Symfony\Component\Cache\Adapter\AdapterInterface" alias="cache.app" />
|
<service id="Symfony\Component\Cache\Adapter\AdapterInterface" alias="cache.app" />
|
||||||
<service id="Symfony\Component\Cache\CacheInterface" alias="cache.app" />
|
<service id="Symfony\Component\Cache\CacheInterface" alias="cache.app.taggable" />
|
||||||
</services>
|
</services>
|
||||||
</container>
|
</container>
|
||||||
|
@ -13,17 +13,17 @@ namespace Symfony\Component\Cache\Adapter;
|
|||||||
|
|
||||||
use Psr\Cache\CacheItemInterface;
|
use Psr\Cache\CacheItemInterface;
|
||||||
use Psr\Cache\InvalidArgumentException;
|
use Psr\Cache\InvalidArgumentException;
|
||||||
|
use Symfony\Component\Cache\CacheInterface;
|
||||||
use Symfony\Component\Cache\CacheItem;
|
use Symfony\Component\Cache\CacheItem;
|
||||||
use Symfony\Component\Cache\PruneableInterface;
|
use Symfony\Component\Cache\PruneableInterface;
|
||||||
use Symfony\Component\Cache\ResettableInterface;
|
use Symfony\Component\Cache\ResettableInterface;
|
||||||
use Symfony\Component\Cache\TaggableCacheInterface;
|
|
||||||
use Symfony\Component\Cache\Traits\GetTrait;
|
use Symfony\Component\Cache\Traits\GetTrait;
|
||||||
use Symfony\Component\Cache\Traits\ProxyTrait;
|
use Symfony\Component\Cache\Traits\ProxyTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Nicolas Grekas <p@tchwork.com>
|
* @author Nicolas Grekas <p@tchwork.com>
|
||||||
*/
|
*/
|
||||||
class TagAwareAdapter implements TagAwareAdapterInterface, TaggableCacheInterface, PruneableInterface, ResettableInterface
|
class TagAwareAdapter implements CacheInterface, TagAwareAdapterInterface, PruneableInterface, ResettableInterface
|
||||||
{
|
{
|
||||||
const TAGS_PREFIX = "\0tags\0";
|
const TAGS_PREFIX = "\0tags\0";
|
||||||
|
|
||||||
|
@ -11,12 +11,12 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Cache\Adapter;
|
namespace Symfony\Component\Cache\Adapter;
|
||||||
|
|
||||||
use Symfony\Component\Cache\TaggableCacheInterface;
|
use Symfony\Component\Cache\CacheInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robin Chalas <robin.chalas@gmail.com>
|
* @author Robin Chalas <robin.chalas@gmail.com>
|
||||||
*/
|
*/
|
||||||
class TraceableTagAwareAdapter extends TraceableAdapter implements TaggableCacheInterface, TagAwareAdapterInterface
|
class TraceableTagAwareAdapter extends TraceableAdapter implements CacheInterface, TagAwareAdapterInterface
|
||||||
{
|
{
|
||||||
public function __construct(TagAwareAdapterInterface $pool)
|
public function __construct(TagAwareAdapterInterface $pool)
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@ CHANGELOG
|
|||||||
4.2.0
|
4.2.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
* added `CacheInterface` and `TaggableCacheInterface`
|
* added `CacheInterface`, which should become the preferred way to use a cache
|
||||||
* throw `LogicException` when `CacheItem::tag()` is called on an item coming from a non tag-aware pool
|
* throw `LogicException` when `CacheItem::tag()` is called on an item coming from a non tag-aware pool
|
||||||
|
|
||||||
3.4.0
|
3.4.0
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Cache;
|
namespace Symfony\Component\Cache;
|
||||||
|
|
||||||
use Psr\Cache\CacheItemInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets and stores items from a cache.
|
* Gets and stores items from a cache.
|
||||||
*
|
*
|
||||||
@ -22,14 +20,12 @@ use Psr\Cache\CacheItemInterface;
|
|||||||
* - the corresponding PSR-6 CacheItemInterface object,
|
* - the corresponding PSR-6 CacheItemInterface object,
|
||||||
* allowing time-based expiration control.
|
* allowing time-based expiration control.
|
||||||
*
|
*
|
||||||
* If you need tag-based invalidation, use TaggableCacheInterface instead.
|
|
||||||
*
|
|
||||||
* @author Nicolas Grekas <p@tchwork.com>
|
* @author Nicolas Grekas <p@tchwork.com>
|
||||||
*/
|
*/
|
||||||
interface CacheInterface
|
interface CacheInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param callable(CacheItemInterface):mixed $callback Should return the computed value for the given key/item
|
* @param callable(CacheItem):mixed $callback Should return the computed value for the given key/item
|
||||||
*
|
*
|
||||||
* @return mixed The value corresponding to the provided key
|
* @return mixed The value corresponding to the provided key
|
||||||
*/
|
*/
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of the Symfony package.
|
|
||||||
*
|
|
||||||
* (c) Fabien Potencier <fabien@symfony.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Symfony\Component\Cache;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets and stores items from a tag-aware cache.
|
|
||||||
*
|
|
||||||
* On cache misses, a callback is called that should return the missing value.
|
|
||||||
* It is given two arguments:
|
|
||||||
* - the missing cache key
|
|
||||||
* - the corresponding Symfony CacheItem object,
|
|
||||||
* allowing time-based *and* tags-based expiration control
|
|
||||||
*
|
|
||||||
* If you don't need tags-based invalidation, use CacheInterface instead.
|
|
||||||
*
|
|
||||||
* @author Nicolas Grekas <p@tchwork.com>
|
|
||||||
*/
|
|
||||||
interface TaggableCacheInterface extends CacheInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param callable(CacheItem):mixed $callback Should return the computed value for the given key/item
|
|
||||||
*
|
|
||||||
* @return mixed The value corresponding to the provided key
|
|
||||||
*/
|
|
||||||
public function get(string $key, callable $callback);
|
|
||||||
}
|
|
Reference in New Issue
Block a user