Skip to content

Commit 01a4110

Browse files
authored
Added support for simple cache (#134)
* Added support for SimpleCache * Added tests * Bugfix with cloning * Style fix * Minor * Updated integration tests version * Bugfix * Allow same keys * cs
1 parent d3d1a60 commit 01a4110

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
/*
4+
* This file is part of php-cache organization.
5+
*
6+
* (c) 2015 Aaron Scherer <[email protected]>, Tobias Nyholm <[email protected]>
7+
*
8+
* This source file is subject to the MIT license that is bundled
9+
* with this source code in the file LICENSE.
10+
*/
11+
12+
namespace Cache\Adapter\Memcache\Tests;
13+
14+
use Cache\Adapter\Memcache\MemcacheCachePool;
15+
use Cache\IntegrationTests\SimpleCacheTest;
16+
use Memcache;
17+
18+
class IntegrationSimpleCacheTest extends SimpleCacheTest
19+
{
20+
private $client;
21+
22+
public function createSimpleCache()
23+
{
24+
if (!class_exists('Memcache')) {
25+
$this->markTestSkipped();
26+
}
27+
28+
return new MemcacheCachePool($this->getClient());
29+
}
30+
31+
private function getClient()
32+
{
33+
if ($this->client === null) {
34+
$this->client = new Memcache();
35+
$this->client->connect('localhost', 11211);
36+
}
37+
38+
return $this->client;
39+
}
40+
}

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626
"require": {
2727
"php": "^5.5 || ^7.0",
2828
"psr/cache": "^1.0",
29+
"psr/simple-cache": "^1.0",
2930
"cache/adapter-common": "^0.4"
3031
},
3132
"require-dev": {
3233
"phpunit/phpunit": "^4.0 || ^5.1",
33-
"cache/integration-tests": "^0.14"
34+
"cache/integration-tests": "^0.16"
3435
},
3536
"suggest": {
3637
"ext-memcache": "The extension required to use this pool."

0 commit comments

Comments
 (0)