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 195ae18 commit 402005b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
27 changes: 27 additions & 0 deletions FilesystemCachePool.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public function __construct(Filesystem $filesystem)
$this->filesystem->createDir(self::CACHE_PATH);
}

/**
* {@inheritdoc}
*/
protected function fetchObjectFromCache($key)
{
$file = $this->getFilePath($key);
Expand All @@ -63,6 +66,9 @@ protected function fetchObjectFromCache($key)
return [true, $data[1], $data[2]];
}

/**
* {@inheritdoc}
*/
protected function clearAllObjectsFromCache()
{
$this->filesystem->deleteDir(self::CACHE_PATH);
Expand All @@ -71,13 +77,19 @@ protected function clearAllObjectsFromCache()
return true;
}

/**
* {@inheritdoc}
*/
protected function clearOneObjectFromCache($key)
{
$this->preRemoveItem($key);

return $this->forceClear($key);
}

/**
* {@inheritdoc}
*/
protected function storeItemInCache(CacheItemInterface $item, $ttl)
{
$file = $this->getFilePath($item->getKey());
Expand Down Expand Up @@ -113,6 +125,9 @@ private function getFilePath($key)
return sprintf('%s/%s', self::CACHE_PATH, $key);
}

/**
* {@inheritdoc}
*/
public function save(CacheItemInterface $item)
{
if ($item instanceof TaggableItemInterface) {
Expand All @@ -122,6 +137,9 @@ public function save(CacheItemInterface $item)
return parent::save($item);
}

/**
* {@inheritdoc}
*/
protected function getList($name)
{
$file = $this->getFilePath($name);
Expand All @@ -133,12 +151,18 @@ protected function getList($name)
return unserialize($this->filesystem->read($file));
}

/**
* {@inheritdoc}
*/
protected function removeList($name)
{
$file = $this->getFilePath($name);
$this->filesystem->delete($file);
}

/**
* {@inheritdoc}
*/
protected function appendListItem($name, $key)
{
$list = $this->getList($name);
Expand All @@ -147,6 +171,9 @@ protected function appendListItem($name, $key)
return $this->filesystem->update($this->getFilePath($name), serialize($list));
}

/**
* {@inheritdoc}
*/
protected function removeListItem($name, $key)
{
$list = $this->getList($name);
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
"require": {
"php": "^5.5|^7.0",
"psr/cache": "^1.0",
"cache/adapter-common": "^0.2",
"cache/taggable-cache": "^0.3",
"cache/adapter-common": "^0.3",
"cache/taggable-cache": "^0.4",
"league/flysystem": "^1.0"
},
"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 402005b

Please sign in to comment.