Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
6951 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace LeadersLinked\Handler;
6
 
7
use Laminas\Db\Adapter\AdapterInterface;
8
use Laminas\Log\LoggerInterface;
9
use LeadersLinked\Mapper\SessionMapper;
10
use Laminas\Session\SaveHandler\SaveHandlerInterface;
11
use SessionHandlerInterface;
12
 
13
 
14
class SessionCacheHandler implements SaveHandlerInterface
15
{
16
 
17
    /**
18
     *
19
     * @var \LeadersLinked\Cache\CacheInterface
20
     */
21
    private $cache;
22
 
23
 
24
    /**
25
     *
26
     * @param \LeadersLinked\Cache\CacheInterface
27
     * @param int $session_lifetime
28
     */
29
    public function __construct($cache)
30
    {
31
        $this->cache = $cache;
32
    }
33
 
34
    /**
35
     *
36
     * {@inheritDoc}
37
     * @see SessionHandlerInterface::close()
38
     */
39
    public function close() : bool
40
    {
41
        return true;
42
    }
43
 
44
    /**
45
     *
46
     * {@inheritDoc}
47
     * @see SessionHandlerInterface::destroy()
48
     */
49
    public function destroy(string $id) : bool
50
    {
51
        $this->cache->removeItem($id);
52
        return true;
53
    }
54
 
55
    /**
56
     *
57
     * {@inheritDoc}
58
     * @see SessionHandlerInterface::gc()
59
     */
60
    public function gc(int $max_lifetime) : int
61
    {
62
       return 0;
63
 
64
    }
65
 
66
    /**
67
     *
68
     * {@inheritDoc}
69
     * @see SessionHandlerInterface::open()
70
     */
71
    public function open(string $path, string $name) : bool
72
    {
73
        return true;
74
    }
75
 
76
    /**
77
     *
78
     * {@inheritDoc}
79
     * @see SessionHandlerInterface::read()
80
     */
81
    public function read(string $id) : string
82
    {
83
        return $this->cache->getItem($id);
84
    }
85
 
86
    /**
87
     *
88
     * {@inheritDoc}
89
     * @see SessionHandlerInterface::write()
90
     */
91
    public function write(string $id, string $data) : bool
92
    {
93
        return $this->cache->setItem($id, $data);
94
    }
95
 
96
 
97
}