blob: 0d56e6019586b1d8dff3e71a5c66a14b250898e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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;
}
}
|