Skip to content

Commit b877e64

Browse files
committed
Making cache tags more efficient by rewriting the API.
Related to php-cache/issues#21
1 parent 32527f6 commit b877e64

File tree

3 files changed

+5
-24
lines changed

3 files changed

+5
-24
lines changed

MemcachedCachePool.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(\Memcached $cache)
4141
protected function fetchObjectFromCache($key)
4242
{
4343
if (false === $result = unserialize($this->cache->get($this->getHierarchyKey($key)))) {
44-
return [false, null];
44+
return [false, null, []];
4545
}
4646

4747
return $result;
@@ -67,17 +67,17 @@ protected function clearOneObjectFromCache($key)
6767
return $this->cache->getResultCode() === \Memcached::RES_NOTFOUND;
6868
}
6969

70-
protected function storeItemInCache($key, CacheItemInterface $item, $ttl)
70+
protected function storeItemInCache(CacheItemInterface $item, $ttl)
7171
{
7272
if ($ttl === null) {
7373
$ttl = 0;
7474
} elseif ($ttl < 0) {
7575
return false;
7676
}
7777

78-
$key = $this->getHierarchyKey($key);
78+
$key = $this->getHierarchyKey($item->getKey());
7979

80-
return $this->cache->set($key, serialize([true, $item->get()]), $ttl);
80+
return $this->cache->set($key, serialize([true, $item->get(), []]), $ttl);
8181
}
8282

8383
protected function getValueFormStore($key)

Tests/IntegrationTagTest.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
"require-dev": {
3535
"phpunit/phpunit": "^4.0|^5.1",
36-
"cache/integration-tests": "0.7.0"
36+
"cache/integration-tests": "0.9.0"
3737
},
3838
"provide": {
3939
"psr/cache-implementation": "^1.0"

0 commit comments

Comments
 (0)