Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 1
FlowObjectCache
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 6
42
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 get
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getMulti
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 set
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 delete
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 makeGlobalKey
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Flow\Data;
4
5use Wikimedia\ObjectCache\WANObjectCache;
6
7class FlowObjectCache {
8    /**
9     * @var WANObjectCache
10     */
11    protected $cache;
12
13    /**
14     * @var int
15     */
16    protected $ttl = 0;
17
18    /**
19     * @param WANObjectCache $cache The cache implementation to back this buffer with
20     * @param int $ttl The default length of time to cache data. 0 for LRU.
21     */
22    public function __construct( WANObjectCache $cache, $ttl = 0 ) {
23        $this->ttl = $ttl;
24        $this->cache = $cache;
25    }
26
27    /**
28     * @param string $key
29     * @return mixed
30     */
31    public function get( $key ) {
32        return $this->cache->get( $key );
33    }
34
35    /**
36     * @param array $keys
37     * @return array
38     */
39    public function getMulti( array $keys ) {
40        return $this->cache->getMulti( $keys );
41    }
42
43    /**
44     * @param string $key
45     * @param mixed $value
46     * @return bool
47     */
48    public function set( $key, $value ) {
49        return $this->cache->set( $key, $value, $this->ttl );
50    }
51
52    /**
53     * @param string $key
54     * @return bool
55     */
56    public function delete( $key ) {
57        return $this->cache->delete( $key );
58    }
59
60    /**
61     * @param string $class
62     * @param string|int ...$components
63     * @return string
64     */
65    public function makeGlobalKey( $class, ...$components ) {
66        return $this->cache->makeGlobalKey( $class, ...$components );
67    }
68}