mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-06-28 15:39:40 +02:00
36 lines
793 B
PHP
36 lines
793 B
PHP
<?php
|
|
|
|
namespace SilverStripe\Core\Cache;
|
|
|
|
use SilverStripe\Core\Injector\Injector;
|
|
use Symfony\Component\Cache\Simple\FilesystemCache;
|
|
|
|
class FilesystemCacheFactory implements CacheFactory
|
|
{
|
|
|
|
/**
|
|
* @var string Absolute directory path
|
|
*/
|
|
protected $directory;
|
|
|
|
/**
|
|
* @param string $directory
|
|
*/
|
|
public function __construct($directory)
|
|
{
|
|
$this->directory = $directory;
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function create($service, array $params = array())
|
|
{
|
|
return Injector::inst()->create(FilesystemCache::class, false, [
|
|
(isset($args['namespace'])) ? $args['namespace'] : '',
|
|
(isset($args['defaultLifetime'])) ? $args['defaultLifetime'] : 0,
|
|
$this->directory
|
|
]);
|
|
}
|
|
}
|