LookupCached::setCaching()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Lookup cached
4
 * User: moyo
5
 * Date: 15/11/2017
6
 * Time: 5:22 PM
7
 */
8
9
namespace Carno\NSQ\Chips;
10
11
use Carno\Cache\Adaptors\Memory;
12
13
trait LookupCached
14
{
15
    /**
16
     * @var Memory
17
     */
18
    private $cached = null;
19
20
    /**
21
     * @var int
22
     */
23
    private $ttl = null;
24
25
    /**
26
     * @param Memory $storing
27
     * @param int $ttl
28
     * @return static
29
     */
30
    public function setCaching(Memory $storing, int $ttl = 60) : self
31
    {
32
        $this->cached = $storing;
33
        $this->ttl = $ttl;
34
        return $this;
35
    }
36
}
37