Skip to content

Commit

Permalink
feature #27398 [Cache] Remove TaggableCacheInterface, alias cache.app…
Browse files Browse the repository at this point in the history
….taggable to CacheInterface (nicolas-grekas)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[Cache] Remove TaggableCacheInterface, alias cache.app.taggable to CacheInterface

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Actually, there is no downside in using a taggable cache pool as a backend for CacheInterface.
This means we can simplify things and remove the TaggableCacheInterface and keep only CacheInterface (master-only).

Commits
-------

c250fbd [Cache] Remove TaggableCacheInterface, alias cache.app.taggable to CacheInterface
  • Loading branch information
fabpot committed May 31, 2018
2 parents 5abffbb + c250fbd commit c81f88f
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 47 deletions.
Expand Up @@ -126,9 +126,8 @@
<service id="cache.global_clearer" parent="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="Symfony\Component\Cache\TaggableCacheInterface" alias="cache.app.taggable" />
<service id="Psr\SimpleCache\CacheInterface" alias="cache.app.simple" />
<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>
</container>
4 changes: 2 additions & 2 deletions src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
Expand Up @@ -13,17 +13,17 @@

use Psr\Cache\CacheItemInterface;
use Psr\Cache\InvalidArgumentException;
use Symfony\Component\Cache\CacheInterface;
use Symfony\Component\Cache\CacheItem;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\Cache\ResettableInterface;
use Symfony\Component\Cache\TaggableCacheInterface;
use Symfony\Component\Cache\Traits\GetTrait;
use Symfony\Component\Cache\Traits\ProxyTrait;

/**
* @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";

Expand Down
Expand Up @@ -11,12 +11,12 @@

namespace Symfony\Component\Cache\Adapter;

use Symfony\Component\Cache\TaggableCacheInterface;
use Symfony\Component\Cache\CacheInterface;

/**
* @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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/CHANGELOG.md
Expand Up @@ -4,7 +4,7 @@ CHANGELOG
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

3.4.0
Expand Down
6 changes: 1 addition & 5 deletions src/Symfony/Component/Cache/CacheInterface.php
Expand Up @@ -11,8 +11,6 @@

namespace Symfony\Component\Cache;

use Psr\Cache\CacheItemInterface;

/**
* Gets and stores items from a cache.
*
Expand All @@ -22,14 +20,12 @@
* - the corresponding PSR-6 CacheItemInterface object,
* allowing time-based expiration control.
*
* If you need tag-based invalidation, use TaggableCacheInterface instead.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
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
*/
Expand Down
35 changes: 0 additions & 35 deletions src/Symfony/Component/Cache/TaggableCacheInterface.php

This file was deleted.

0 comments on commit c81f88f

Please sign in to comment.