Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc33e47c

Browse files
[Cache] Add [Taggable]CacheInterface, the easiest way to use a cache
1 parent782ffe2 commitc33e47c

File tree

18 files changed

+283
-9
lines changed

18 files changed

+283
-9
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
<argumenttype="service"id="cache.app" />
1616
</service>
1717

18+
<serviceid="cache.app.taggable"class="Symfony\Component\Cache\Adapter\TagAwareAdapter">
19+
<argumenttype="service"id="cache.app" />
20+
</service>
21+
1822
<serviceid="cache.system"parent="cache.adapter.system"public="true">
1923
<tagname="cache.pool" />
2024
</service>
@@ -122,7 +126,9 @@
122126
<serviceid="cache.global_clearer"parent="cache.default_clearer"public="true" />
123127
<serviceid="cache.app_clearer"alias="cache.default_clearer"public="true" />
124128
<serviceid="Psr\Cache\CacheItemPoolInterface"alias="cache.app" />
129+
<serviceid="Symfony\Component\Cache\TaggableCacheInterface"alias="cache.app.taggable" />
125130
<serviceid="Psr\SimpleCache\CacheInterface"alias="cache.app.simple" />
126131
<serviceid="Symfony\Component\Cache\Adapter\AdapterInterface"alias="cache.app" />
132+
<serviceid="Symfony\Component\Cache\CacheInterface"alias="cache.app" />
127133
</services>
128134
</container>

‎src/Symfony/Component/Cache/Adapter/AbstractAdapter.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,20 @@
1515
usePsr\Log\LoggerAwareInterface;
1616
usePsr\Log\LoggerInterface;
1717
usePsr\Log\NullLogger;
18+
useSymfony\Component\Cache\CacheInterface;
1819
useSymfony\Component\Cache\CacheItem;
1920
useSymfony\Component\Cache\Exception\InvalidArgumentException;
2021
useSymfony\Component\Cache\ResettableInterface;
2122
useSymfony\Component\Cache\Traits\AbstractTrait;
23+
useSymfony\Component\Cache\Traits\GetTrait;
2224

2325
/**
2426
* @author Nicolas Grekas <p@tchwork.com>
2527
*/
26-
abstractclass AbstractAdapterimplements AdapterInterface, LoggerAwareInterface, ResettableInterface
28+
abstractclass AbstractAdapterimplements AdapterInterface,CacheInterface,LoggerAwareInterface, ResettableInterface
2729
{
2830
use AbstractTrait;
31+
use GetTrait;
2932

3033
privatestatic$apcuSupported;
3134
privatestatic$phpFilesSupported;

‎src/Symfony/Component/Cache/Adapter/ArrayAdapter.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@
1313

1414
usePsr\Cache\CacheItemInterface;
1515
usePsr\Log\LoggerAwareInterface;
16+
useSymfony\Component\Cache\CacheInterface;
1617
useSymfony\Component\Cache\CacheItem;
1718
useSymfony\Component\Cache\ResettableInterface;
1819
useSymfony\Component\Cache\Traits\ArrayTrait;
20+
useSymfony\Component\Cache\Traits\GetTrait;
1921

2022
/**
2123
* @author Nicolas Grekas <p@tchwork.com>
2224
*/
23-
class ArrayAdapterimplements AdapterInterface, LoggerAwareInterface, ResettableInterface
25+
class ArrayAdapterimplements AdapterInterface,CacheInterface,LoggerAwareInterface, ResettableInterface
2426
{
2527
use ArrayTrait;
28+
use GetTrait;
2629

2730
private$createCacheItem;
2831

‎src/Symfony/Component/Cache/Adapter/ChainAdapter.php‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313

1414
usePsr\Cache\CacheItemInterface;
1515
usePsr\Cache\CacheItemPoolInterface;
16+
useSymfony\Component\Cache\CacheInterface;
1617
useSymfony\Component\Cache\CacheItem;
1718
useSymfony\Component\Cache\Exception\InvalidArgumentException;
1819
useSymfony\Component\Cache\PruneableInterface;
1920
useSymfony\Component\Cache\ResettableInterface;
21+
useSymfony\Component\Cache\Traits\GetTrait;
2022

2123
/**
2224
* Chains several adapters together.
@@ -26,8 +28,10 @@
2628
*
2729
* @author Kévin Dunglas <dunglas@gmail.com>
2830
*/
29-
class ChainAdapterimplements AdapterInterface, PruneableInterface, ResettableInterface
31+
class ChainAdapterimplements AdapterInterface,CacheInterface,PruneableInterface, ResettableInterface
3032
{
33+
use GetTrait;
34+
3135
private$adapters =array();
3236
private$adapterCount;
3337
private$saveUp;

‎src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313

1414
usePsr\Cache\CacheItemInterface;
1515
usePsr\Cache\CacheItemPoolInterface;
16+
useSymfony\Component\Cache\CacheInterface;
1617
useSymfony\Component\Cache\CacheItem;
1718
useSymfony\Component\Cache\Exception\InvalidArgumentException;
1819
useSymfony\Component\Cache\PruneableInterface;
1920
useSymfony\Component\Cache\ResettableInterface;
21+
useSymfony\Component\Cache\Traits\GetTrait;
2022
useSymfony\Component\Cache\Traits\PhpArrayTrait;
2123

2224
/**
@@ -26,9 +28,10 @@
2628
* @author Titouan Galopin <galopintitouan@gmail.com>
2729
* @author Nicolas Grekas <p@tchwork.com>
2830
*/
29-
class PhpArrayAdapterimplements AdapterInterface, PruneableInterface, ResettableInterface
31+
class PhpArrayAdapterimplements AdapterInterface,CacheInterface,PruneableInterface, ResettableInterface
3032
{
3133
use PhpArrayTrait;
34+
use GetTrait;
3235

3336
private$createCacheItem;
3437

‎src/Symfony/Component/Cache/Adapter/ProxyAdapter.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,20 @@
1313

1414
usePsr\Cache\CacheItemInterface;
1515
usePsr\Cache\CacheItemPoolInterface;
16+
useSymfony\Component\Cache\CacheInterface;
1617
useSymfony\Component\Cache\CacheItem;
1718
useSymfony\Component\Cache\PruneableInterface;
1819
useSymfony\Component\Cache\ResettableInterface;
20+
useSymfony\Component\Cache\Traits\GetTrait;
1921
useSymfony\Component\Cache\Traits\ProxyTrait;
2022

2123
/**
2224
* @author Nicolas Grekas <p@tchwork.com>
2325
*/
24-
class ProxyAdapterimplements AdapterInterface, PruneableInterface, ResettableInterface
26+
class ProxyAdapterimplements AdapterInterface,CacheInterface,PruneableInterface, ResettableInterface
2527
{
2628
use ProxyTrait;
29+
use GetTrait;
2730

2831
private$namespace;
2932
private$namespaceLen;

‎src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,19 @@
1616
useSymfony\Component\Cache\CacheItem;
1717
useSymfony\Component\Cache\PruneableInterface;
1818
useSymfony\Component\Cache\ResettableInterface;
19+
useSymfony\Component\Cache\TaggableCacheInterface;
20+
useSymfony\Component\Cache\Traits\GetTrait;
1921
useSymfony\Component\Cache\Traits\ProxyTrait;
2022

2123
/**
2224
* @author Nicolas Grekas <p@tchwork.com>
2325
*/
24-
class TagAwareAdapterimplements TagAwareAdapterInterface, PruneableInterface, ResettableInterface
26+
class TagAwareAdapterimplements TagAwareAdapterInterface,TaggableCacheInterface,PruneableInterface, ResettableInterface
2527
{
2628
constTAGS_PREFIX ="\0tags\0";
2729

2830
use ProxyTrait;
31+
use GetTrait;
2932

3033
private$deferred =array();
3134
private$createCacheItem;
@@ -55,6 +58,7 @@ function ($key, $value, CacheItem $protoItem) {
5558
);
5659
$this->setCacheItemTags = \Closure::bind(
5760
function (CacheItem$item,$key,array &$itemTags) {
61+
$item->isTaggable =true;
5862
if (!$item->isHit) {
5963
return$item;
6064
}

‎src/Symfony/Component/Cache/Adapter/TraceableAdapter.php‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
namespaceSymfony\Component\Cache\Adapter;
1313

1414
usePsr\Cache\CacheItemInterface;
15+
useSymfony\Component\Cache\CacheInterface;
1516
useSymfony\Component\Cache\PruneableInterface;
1617
useSymfony\Component\Cache\ResettableInterface;
18+
useSymfony\Component\Cache\Traits\GetTrait;
1719

1820
/**
1921
* An adapter that collects data about all cache calls.
@@ -22,8 +24,10 @@
2224
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
2325
* @author Nicolas Grekas <p@tchwork.com>
2426
*/
25-
class TraceableAdapterimplements AdapterInterface, PruneableInterface, ResettableInterface
27+
class TraceableAdapterimplements AdapterInterface,CacheInterface,PruneableInterface, ResettableInterface
2628
{
29+
use GetTrait;
30+
2731
protected$pool;
2832
private$calls =array();
2933

‎src/Symfony/Component/Cache/Adapter/TraceableTagAwareAdapter.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111

1212
namespaceSymfony\Component\Cache\Adapter;
1313

14+
useSymfony\Component\Cache\TaggableCacheInterface;
15+
1416
/**
1517
* @author Robin Chalas <robin.chalas@gmail.com>
1618
*/
17-
class TraceableTagAwareAdapterextends TraceableAdapterimplements TagAwareAdapterInterface
19+
class TraceableTagAwareAdapterextends TraceableAdapterimplementsTaggableCacheInterface,TagAwareAdapterInterface
1820
{
1921
publicfunction__construct(TagAwareAdapterInterface$pool)
2022
{

‎src/Symfony/Component/Cache/CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
4.1.0
5+
-----
6+
7+
* added`CacheInterface` and`TaggableCacheInterface`
8+
* throw`LogicException` when`CacheItem::tag()` is called on an item coming from a non tag-aware pool
9+
410
3.4.0
511
-----
612

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp