MemcachedRepository::flush()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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