Add FileCache driver

This commit is contained in:
Frederic Guillot
2016-08-21 18:46:34 -04:00
parent 836e935463
commit 8e83e404fb
15 changed files with 442 additions and 118 deletions

View File

@@ -0,0 +1,41 @@
<?php
namespace Kanboard\ServiceProvider;
use Kanboard\Core\Cache\FileCache;
use Kanboard\Core\Cache\MemoryCache;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
/**
* Cache Provider
*
* @package Kanboard\ServiceProvider
* @author Frederic Guillot
*/
class CacheProvider implements ServiceProviderInterface
{
/**
* Register providers
*
* @access public
* @param \Pimple\Container $container
* @return \Pimple\Container
*/
public function register(Container $container)
{
$container['memoryCache'] = function() {
return new MemoryCache();
};
if (CACHE_DRIVER === 'file') {
$container['cacheDriver'] = function() {
return new FileCache();
};
} else {
$container['cacheDriver'] = $container['memoryCache'];
}
return $container;
}
}