Skip to content

Commit

Permalink
Tagging bugfix and updated tests to ^0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm committed Feb 25, 2016
1 parent 737e630 commit ae17bbb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
30 changes: 30 additions & 0 deletions RedisCachePool.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public function __construct(\Redis $cache)
$this->cache = $cache;
}

/**
* {@inheritdoc}
*/
protected function fetchObjectFromCache($key)
{
if (false === $result = unserialize($this->cache->get($this->getHierarchyKey($key)))) {
Expand All @@ -49,11 +52,17 @@ protected function fetchObjectFromCache($key)
return $result;
}

/**
* {@inheritdoc}
*/
protected function clearAllObjectsFromCache()
{
return $this->cache->flushDb();
}

/**
* {@inheritdoc}
*/
protected function clearOneObjectFromCache($key)
{
$this->commit();
Expand All @@ -65,6 +74,9 @@ protected function clearOneObjectFromCache($key)
return $this->cache->del($keyString) >= 0;
}

/**
* {@inheritdoc}
*/
protected function storeItemInCache(CacheItemInterface $item, $ttl)
{
$key = $this->getHierarchyKey($item->getKey());
Expand All @@ -76,6 +88,9 @@ protected function storeItemInCache(CacheItemInterface $item, $ttl)
return $this->cache->setex($key, $ttl, $data);
}

/**
* {@inheritdoc}
*/
public function save(CacheItemInterface $item)
{
if ($item instanceof TaggableItemInterface) {
Expand All @@ -85,26 +100,41 @@ public function save(CacheItemInterface $item)
return parent::save($item);
}

/**
* {@inheritdoc}
*/
protected function getValueFormStore($key)
{
return $this->cache->get($key);
}

/**
* {@inheritdoc}
*/
protected function appendListItem($name, $value)
{
$this->cache->lPush($name, $value);
}

/**
* {@inheritdoc}
*/
protected function getList($name)
{
return $this->cache->lRange($name, 0, -1);
}

/**
* {@inheritdoc}
*/
protected function removeList($name)
{
return $this->cache->del($name);
}

/**
* {@inheritdoc}
*/
protected function removeListItem($name, $key)
{
return $this->cache->lrem($name, $key, 0);
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
"php": "^5.5|^7.0",
"ext-redis": "*",
"psr/cache": "^1.0",
"cache/adapter-common": "^0.2",
"cache/taggable-cache": "^0.3",
"cache/adapter-common": "^0.3",
"cache/taggable-cache": "^0.4",
"cache/hierarchical-cache": "^0.2"
},
"require-dev": {
"phpunit/phpunit": "^4.0|^5.1",
"cache/integration-tests": "0.9.0"
"cache/integration-tests": "^0.9"
},
"provide": {
"psr/cache-implementation": "^1.0"
Expand Down

0 comments on commit ae17bbb

Please sign in to comment.