1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-09 22:56:46 +02:00

feat(core): add PhpFileAdapter for PHPFile Cache and set PhpFile Cache as a default fallback cache driver instead of Filesystem Cache driver

This commit is contained in:
Awilum
2020-07-26 18:47:56 +03:00
parent 6b0c8dc698
commit 7a52754514
2 changed files with 29 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace Flextype\App\Foundation\Cache;
use Doctrine\Common\Cache\PhpFileCache;
use Psr\Container\ContainerInterface;
use Flextype\Component\Filesystem\Filesystem;
class PhpFileAdapter implements CacheAdapterInterface
{
public function __construct(ContainerInterface $flextype)
{
$this->flextype = $flextype;
}
public function getDriver() : object
{
$cache_directory = PATH['cache'] . '/doctrine/';
if (! Filesystem::has($cache_directory)) {
Filesystem::createDir($cache_directory);
}
return new PhpFileCache($cache_directory);
}
}

View File

@@ -112,7 +112,7 @@ $flextype['cache_adapter'] = function ($container) use ($flextype) {
} elseif (extension_loaded('wincache')) {
$driver_name = 'wincache';
} else {
$driver_name = 'filesystem';
$driver_name = 'PhpFile';
}
}