MemcachedRepository   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A flush() 0 3 1
A retrieve() 0 3 1
A __construct() 0 2 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
     * MemcachedRepository constructor.
12
     *
13
     * @param Memcached $memcached
14
     */
15
    public function __construct(protected Memcached $memcached)
16
    {
17
        //
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23 6
    protected function retrieve(string $key): mixed
24
    {
25 6
        return $this->memcached->get($key);
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31 6
    protected function store(string $key, Collection $collection): bool
32
    {
33 6
        return $this->memcached->set($key, $collection);
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39 6
    public function flush(): bool
40
    {
41 6
        return $this->memcached->flush();
42
    }
43
}
44