CacheFacade   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
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 16
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
declare(strict_types=1);
4
5
/*
6
 * This file is part of forecast.it.fill project.
7
 * (c) Patrick Jaja <[email protected]>
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace ForecastAutomation\Cache;
13
14
use ForecastAutomation\Kernel\AbstractFacade;
15
use Shieldon\SimpleCache\Cache;
16
17
/**
18
 * @method \ForecastAutomation\Cache\CacheFactory getFactory()
19
 */
20
class CacheFacade extends AbstractFacade
21
{
22
    public function get($key, $default = null): mixed
23
    {
24
        //ToDo: Move str_replace to Business + add cache disable option means has = always false
25
        return $this->getFactory()->createSimpleCache()->get(\str_replace('/', '', $key), $default);
26
    }
27
28
    public function has($key): bool
29
    {
30
        return $this->getFactory()->createSimpleCache()->has(\str_replace('/', '', $key));
31
    }
32
33
    public function set($key, $value, $ttl = 600): bool
34
    {
35
        return $this->getFactory()->createSimpleCache()->set(\str_replace('/', '', $key), $value, $ttl);
36
    }
37
}
38