Repository navigation
Expand file tree
/
Copy pathEngine.php
More file actions
111 lines (88 loc) · 1.78 KB
/
Copy pathEngine.php
File metadata and controls
111 lines (88 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
abstract class EtuDev_Cache_Engine
{
/**
* @var EtuDev_Cache_Driver
*/
protected $driver;
protected $loaded = false;
public function __construct()
{
$this->loadDriver();
$this->loaded = true;
}
abstract protected function loadDriver();
/**
* @return bool
*/
public function isEnabled()
{
if (!$this->loaded) {
$this->loadDriver();
}
if (!$this->driver) {
return false;
}
return $this->driver->isEnabled();
}
/**
* @param string $key
* @param mixed $value
* @param int $ttl
*
* @return bool|mixed
*/
public function set($key, $value, $ttl = 3600)
{
if (!$this->loaded) {
$this->loadDriver();
}
if (!$this->driver) {
return false;
}
return $this->driver->set($key, $value, $ttl);
}
/**
* @param string $key
*
* @return bool|mixed
*/
public function get($key)
{
if (!$this->loaded) {
$this->loadDriver();
}
if (!$this->driver) {
return false;
}
return $this->driver->get($key);
}
/**
* @return mixed
*/
public function flush()
{
if (!$this->loaded) {
$this->loadDriver();
}
if (!$this->driver) {
return false;
}
return $this->driver->flush();
}
/**
* @param string $key
*
* @return bool|mixed
*/
public function delete($key)
{
if (!$this->loaded) {
$this->loadDriver();
}
if (!$this->driver) {
return false;
}
return $this->driver->delete($key);
}
}