Passed
Push — master ( f6e659...bb9ac5 )
by Patrick
04:00
created

CacheFacade   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
dl 0
loc 14
rs 10
ccs 0
cts 6
cp 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A has() 0 3 1
A get() 0 4 1
A set() 0 3 1
1
<?php
2
3
namespace ForecastAutomation\Cache;
4
5
use ForecastAutomation\Kernel\AbstractFacade;
6
use Shieldon\SimpleCache\Cache;
7
8
/**
9
 * @method \ForecastAutomation\Cache\CacheFactory getFactory()
10
 */
11
class CacheFacade extends AbstractFacade
12
{
13
    public function get($key, $default = null):mixed
14
    {
15
        //ToDo: Move str_replace to Business + add cache disable option means has = always false
16
        return $this->getFactory()->createSimpleCache()->get(\str_replace('/','',$key), $default);
17
    }
18
    public function has($key):bool
19
    {
20
        return $this->getFactory()->createSimpleCache()->has(\str_replace('/','',$key));
21
    }
22
    public function set($key, $value, $ttl = 600):bool
23
    {
24
        return $this->getFactory()->createSimpleCache()->set(\str_replace('/','',$key), $value, $ttl);
25
    }
26
}
27