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

Commit358132f

Browse files
committed
Make TraceableAdapter TagAware
1 parentadc39a2 commit358132f

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
2121
* @author Nicolas Grekas <p@tchwork.com>
2222
*/
23-
class TraceableAdapterimplementsAdapterInterface
23+
class TraceableAdapterimplementsTagAwareAdapterInterface
2424
{
2525
private$pool;
2626
private$calls =array();
@@ -168,6 +168,19 @@ public function commit()
168168
}
169169
}
170170

171+
/**
172+
* {@inheritdoc}
173+
*/
174+
publicfunctioninvalidateTags(array$tags)
175+
{
176+
$event =$this->start(__FUNCTION__,$tags);
177+
try {
178+
return$event->result =$this->pool->invalidateTags($tags);
179+
}finally {
180+
$event->end =microtime(true);
181+
}
182+
}
183+
171184
publicfunctiongetCalls()
172185
{
173186
try {

‎src/Symfony/Component/Cache/Tests/Adapter/TraceableAdapterTest.php‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespaceSymfony\Component\Cache\Tests\Adapter;
1313

1414
useSymfony\Component\Cache\Adapter\FilesystemAdapter;
15+
useSymfony\Component\Cache\Adapter\TagAwareAdapter;
1516
useSymfony\Component\Cache\Adapter\TraceableAdapter;
1617

1718
/**
@@ -184,4 +185,20 @@ public function testCommitTrace()
184185
$this->assertNotEmpty($call->start);
185186
$this->assertNotEmpty($call->end);
186187
}
188+
189+
publicfunctiontestInvalidateTags()
190+
{
191+
$pool =newTraceableAdapter(newTagAwareAdapter(newFilesystemAdapter()));
192+
$pool->invalidateTags(array('foo'));
193+
$calls =$pool->getCalls();
194+
$this->assertCount(1,$calls);
195+
196+
$call =$calls[0];
197+
$this->assertSame('invalidateTags',$call->name);
198+
$this->assertSame(array('foo'),$call->argument);
199+
$this->assertSame(0,$call->hits);
200+
$this->assertSame(0,$call->misses);
201+
$this->assertNotEmpty($call->start);
202+
$this->assertNotEmpty($call->end);
203+
}
187204
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp