Completed
Push — develop ( 3605f5...4a88bc )
by Stan
04:14
created

MemcachedRepository   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
dl 0
loc 39
ccs 6
cts 9
cp 0.6667
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A flush() 0 3 1
A retrieve() 0 3 1
A __construct() 0 3 1
A store() 0 3 1
1
<?php
2
3
namespace Krenor\Prometheus\Storage\Repositories;
4
5
use Memcached;
6
use Tightenco\Collect\Support\Collection;
7
8
class MemcachedRepository extends SimpleRepository
9
{
10
    /**
11
     * @var Memcached
12
     */
13
    protected $memcached;
14
15
    /**
16
     * MemcachedRepository constructor.
17
     *
18
     * @param Memcached $memcached
19
     */
20
    public function __construct(Memcached $memcached)
21
    {
22
        $this->memcached = $memcached;
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 6
    public function flush(): bool
29
    {
30 6
        return $this->memcached->flush();
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 6
    protected function retrieve(string $key)
37
    {
38 6
        return $this->memcached->get($key);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44 6
    protected function store(string $key, Collection $collection): bool
45
    {
46 6
        return $this->memcached->set($key, $collection);
47
    }
48
}
49