Skip to content

Commit 3d9cb28

Browse files
committed
Add MemoryCacheEngine.php
1 parent 139bef7 commit 3d9cb28

File tree

3 files changed

+42
-20
lines changed

3 files changed

+42
-20
lines changed

phpunit.xml.dist

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,33 @@ To change this license header, choose License Headers in Project Properties.
44
To change this template file, choose Tools | Templates
55
and open the template in the editor.
66
-->
7-
87
<!-- see http://www.phpunit.de/wiki/Documentation -->
9-
<phpunit bootstrap="./vendor/autoload.php"
8+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
bootstrap="./vendor/autoload.php"
1010
colors="true"
1111
testdox="true"
1212
convertErrorsToExceptions="true"
1313
convertNoticesToExceptions="true"
1414
convertWarningsToExceptions="true"
1515
convertDeprecationsToExceptions="true"
16-
stopOnFailure="false">
16+
stopOnFailure="false"
17+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
18+
19+
<php>
20+
<ini name="display_errors" value="On"/>
21+
<ini name="display_startup_errors" value="On"/>
22+
<ini name="error_reporting" value="E_ALL"/>
23+
</php>
1724

18-
<php>
19-
<ini name="display_errors" value="On" />
20-
<ini name="display_startup_errors" value="On" />
21-
<ini name="error_reporting" value="E_ALL" />
22-
</php>
25+
<coverage>
26+
<include>
27+
<directory>./src</directory>
28+
</include>
29+
</coverage>
2330

24-
<filter>
25-
<whitelist>
26-
<directory>./src</directory>
27-
</whitelist>
28-
</filter>
29-
30-
<testsuites>
31-
<testsuite name="Test Suite">
32-
<directory>./tests/</directory>
33-
</testsuite>
34-
</testsuites>
35-
31+
<testsuites>
32+
<testsuite name="Test Suite">
33+
<directory>./tests/</directory>
34+
</testsuite>
35+
</testsuites>
3636
</phpunit>

src/Psr16/MemoryCacheEngine.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace ByJG\Cache\Psr16;
4+
5+
use ByJG\Cache\CacheLockInterface;
6+
use ByJG\Cache\Exception\InvalidArgumentException;
7+
use DateInterval;
8+
use Psr\Container\ContainerExceptionInterface;
9+
use Psr\Container\NotFoundExceptionInterface;
10+
use Psr\Log\LoggerInterface;
11+
12+
class MemoryCacheEngine extends FileSystemCacheEngine
13+
{
14+
15+
public function __construct(?LoggerInterface $logger = null)
16+
{
17+
parent::__construct('cache', '/dev/shm', $logger);
18+
}
19+
}

tests/BaseCacheTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public function CachePoolProvider()
4747
],
4848
'Redis' => [
4949
new \ByJG\Cache\Psr16\RedisCacheEngine($redisCacheServer, $redisPassword)
50+
],
51+
'Memory' => [
52+
new \ByJG\Cache\Psr16\MemoryCacheEngine()
5053
]
5154
];
5255
}

0 commit comments

Comments
 (0)