Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
namespace Aws;
3
 
4
use Doctrine\Common\Cache\Cache;
5
 
6
class DoctrineCacheAdapter implements CacheInterface, Cache
7
{
8
    /** @var Cache */
9
    private $cache;
10
 
11
    public function __construct(Cache $cache)
12
    {
13
        $this->cache = $cache;
14
    }
15
 
16
    public function get($key)
17
    {
18
        return $this->cache->fetch($key);
19
    }
20
 
1441 ariadna 21
    /**
22
     * @return mixed
23
     */
1 efrain 24
    public function fetch($key)
25
    {
26
        return $this->get($key);
27
    }
28
 
29
    public function set($key, $value, $ttl = 0)
30
    {
31
        return $this->cache->save($key, $value, $ttl);
32
    }
33
 
1441 ariadna 34
    /**
35
     * @return bool
36
     */
1 efrain 37
    public function save($key, $value, $ttl = 0)
38
    {
39
        return $this->set($key, $value, $ttl);
40
    }
41
 
42
    public function remove($key)
43
    {
44
        return $this->cache->delete($key);
45
    }
46
 
1441 ariadna 47
    /**
48
     * @return bool
49
     */
1 efrain 50
    public function delete($key)
51
    {
52
        return $this->remove($key);
53
    }
54
 
1441 ariadna 55
    /**
56
     * @return bool
57
     */
1 efrain 58
    public function contains($key)
59
    {
60
        return $this->cache->contains($key);
61
    }
62
 
1441 ariadna 63
    /**
64
     * @return mixed[]|null
65
     */
1 efrain 66
    public function getStats()
67
    {
68
        return $this->cache->getStats();
69
    }
70
}