Test Failed
Pull Request — master (#19)
by Alexander
01:57
created

SimpleCacheStorage::save()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\RateLimiter\Storage;
6
7
use Psr\SimpleCache\CacheInterface;
8
9
final class SimpleCacheStorage implements StorageInterface
10
{
11
    private CacheInterface $cache;
12
13
    public function __construct(CacheInterface $cache)
14
    {
15
        $this->cache = $cache;
16
    }
17
18
    public function save(string $key, $value, int $ttl): void
19
    {
20
        $this->cache->set($key, $value, $ttl);
21
    }
22
23
    public function get(string $key, $default = null)
24
    {
25
        return $this->cache->get($key, $default);
26
    }
27
}
28