1
|
|
|
<?php namespace Comodojo\SimpleCache\Components; |
2
|
|
|
|
3
|
|
|
use \Comodojo\Cache\Components\ConfigurationParser as CacheConfigurationParser; |
4
|
|
|
use \Psr\Log\LoggerInterface; |
5
|
|
|
use \Comodojo\SimpleCache\Providers\Apc as SimpleCacheApc; |
6
|
|
|
use \Comodojo\SimpleCache\Providers\Apcu as SimpleCacheApcu; |
7
|
|
|
use \Comodojo\SimpleCache\Providers\Filesystem as SimpleCacheFilesystem; |
8
|
|
|
use \Comodojo\SimpleCache\Providers\Memcached as SimpleCacheMemcached; |
9
|
|
|
use \Comodojo\SimpleCache\Providers\Memory as SimpleCacheMemory; |
10
|
|
|
use \Comodojo\SimpleCache\Providers\PhpRedis as SimpleCachePhpRedis; |
11
|
|
|
use \Comodojo\SimpleCache\Providers\Vacuum as SimpleCacheVacuum; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @package Comodojo Spare Parts |
15
|
|
|
* @author Marco Giovinazzi <[email protected]> |
16
|
|
|
* @license MIT |
17
|
|
|
* |
18
|
|
|
* LICENSE: |
19
|
|
|
* |
20
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
21
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
22
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
23
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
24
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
25
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
26
|
|
|
* THE SOFTWARE. |
27
|
|
|
*/ |
28
|
|
|
|
29
|
|
|
class ConfigurationParser extends CacheConfigurationParser { |
30
|
|
|
|
31
|
1 |
|
protected static function BuildApcProvider(LoggerInterface $logger) { |
32
|
|
|
|
33
|
1 |
|
return new SimpleCacheApc($logger); |
34
|
|
|
|
35
|
|
|
} |
36
|
|
|
|
37
|
1 |
|
protected static function BuildApcuProvider(LoggerInterface $logger) { |
38
|
|
|
|
39
|
1 |
|
return new SimpleCacheApcu($logger); |
40
|
|
|
|
41
|
|
|
} |
42
|
|
|
|
43
|
1 |
|
protected static function BuildFilesystemProvider($cache_folder, LoggerInterface $logger) { |
44
|
|
|
|
45
|
1 |
|
return new SimpleCacheFilesystem($cache_folder, $logger); |
46
|
|
|
|
47
|
|
|
} |
48
|
|
|
|
49
|
1 |
|
protected static function BuildMemcachedProvider($server, $port, $weight, $persistentid, LoggerInterface $logger) { |
50
|
|
|
|
51
|
1 |
|
return new SimpleCacheMemcached($server, $port, $weight, $persistentid, $logger); |
52
|
|
|
|
53
|
|
|
} |
54
|
|
|
|
55
|
1 |
|
protected static function BuildMemoryProvider(LoggerInterface $logger) { |
56
|
|
|
|
57
|
1 |
|
return new SimpleCacheMemory($logger); |
58
|
|
|
|
59
|
|
|
} |
60
|
|
|
|
61
|
1 |
|
protected static function BuildPhpRedisProvider($server, $port, $timeout, LoggerInterface $logger) { |
62
|
|
|
|
63
|
1 |
|
return new SimpleCachePhpRedis($server, $port, $timeout, $logger); |
64
|
|
|
|
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
protected static function BuildVacuumProvider(LoggerInterface $logger) { |
68
|
|
|
|
69
|
|
|
return new SimpleCacheVacuum($logger); |
70
|
|
|
|
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
} |
74
|
|
|
|