Skip to content

Commit

Permalink
Add MemoryCacheEngine.php
Browse files Browse the repository at this point in the history
  • Loading branch information
byjg committed Dec 18, 2024
1 parent 139bef7 commit 3d9cb28
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 20 deletions.
40 changes: 20 additions & 20 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,33 @@ To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->

<!-- see http://www.phpunit.de/wiki/Documentation -->
<phpunit bootstrap="./vendor/autoload.php"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="./vendor/autoload.php"
colors="true"
testdox="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
convertDeprecationsToExceptions="true"
stopOnFailure="false">
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">

<php>
<ini name="display_errors" value="On"/>
<ini name="display_startup_errors" value="On"/>
<ini name="error_reporting" value="E_ALL"/>
</php>

<php>
<ini name="display_errors" value="On" />
<ini name="display_startup_errors" value="On" />
<ini name="error_reporting" value="E_ALL" />
</php>
<coverage>
<include>
<directory>./src</directory>
</include>
</coverage>

<filter>
<whitelist>
<directory>./src</directory>
</whitelist>
</filter>

<testsuites>
<testsuite name="Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<testsuites>
<testsuite name="Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
19 changes: 19 additions & 0 deletions src/Psr16/MemoryCacheEngine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace ByJG\Cache\Psr16;

use ByJG\Cache\CacheLockInterface;
use ByJG\Cache\Exception\InvalidArgumentException;
use DateInterval;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Log\LoggerInterface;

class MemoryCacheEngine extends FileSystemCacheEngine
{

public function __construct(?LoggerInterface $logger = null)
{
parent::__construct('cache', '/dev/shm', $logger);
}
}
3 changes: 3 additions & 0 deletions tests/BaseCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public function CachePoolProvider()
],
'Redis' => [
new \ByJG\Cache\Psr16\RedisCacheEngine($redisCacheServer, $redisPassword)
],
'Memory' => [
new \ByJG\Cache\Psr16\MemoryCacheEngine()
]
];
}
Expand Down

0 comments on commit 3d9cb28

Please sign in to comment.