@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | public function get($key) { |
55 | - $result = self::$cache->get($this->getNameSpace() . $key); |
|
56 | - if ($result === false && !self::$cache->exists($this->getNameSpace() . $key)) { |
|
55 | + $result = self::$cache->get($this->getNameSpace().$key); |
|
56 | + if ($result === false && !self::$cache->exists($this->getNameSpace().$key)) { |
|
57 | 57 | return null; |
58 | 58 | } else { |
59 | 59 | return json_decode($result, true); |
@@ -62,18 +62,18 @@ discard block |
||
62 | 62 | |
63 | 63 | public function set($key, $value, $ttl = 0) { |
64 | 64 | if ($ttl > 0) { |
65 | - return self::$cache->setex($this->getNameSpace() . $key, $ttl, json_encode($value)); |
|
65 | + return self::$cache->setex($this->getNameSpace().$key, $ttl, json_encode($value)); |
|
66 | 66 | } else { |
67 | - return self::$cache->set($this->getNameSpace() . $key, json_encode($value)); |
|
67 | + return self::$cache->set($this->getNameSpace().$key, json_encode($value)); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | 71 | public function hasKey($key) { |
72 | - return self::$cache->exists($this->getNameSpace() . $key); |
|
72 | + return self::$cache->exists($this->getNameSpace().$key); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | public function remove($key) { |
76 | - if (self::$cache->del($this->getNameSpace() . $key)) { |
|
76 | + if (self::$cache->del($this->getNameSpace().$key)) { |
|
77 | 77 | return true; |
78 | 78 | } else { |
79 | 79 | return false; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | public function clear($prefix = '') { |
84 | - $prefix = $this->getNameSpace() . $prefix . '*'; |
|
84 | + $prefix = $this->getNameSpace().$prefix.'*'; |
|
85 | 85 | $keys = self::$cache->keys($prefix); |
86 | 86 | $deleted = self::$cache->del($keys); |
87 | 87 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $args['ex'] = $ttl; |
108 | 108 | } |
109 | 109 | |
110 | - return self::$cache->set($this->getPrefix() . $key, $value, $args); |
|
110 | + return self::$cache->set($this->getPrefix().$key, $value, $args); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @return int | bool |
119 | 119 | */ |
120 | 120 | public function inc($key, $step = 1) { |
121 | - return self::$cache->incrBy($this->getNameSpace() . $key, $step); |
|
121 | + return self::$cache->incrBy($this->getNameSpace().$key, $step); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | if (!$this->hasKey($key)) { |
133 | 133 | return false; |
134 | 134 | } |
135 | - return self::$cache->decrBy($this->getNameSpace() . $key, $step); |
|
135 | + return self::$cache->decrBy($this->getNameSpace().$key, $step); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | if (!is_int($new)) { |
148 | 148 | $new = json_encode($new); |
149 | 149 | } |
150 | - self::$cache->watch($this->getNameSpace() . $key); |
|
150 | + self::$cache->watch($this->getNameSpace().$key); |
|
151 | 151 | if ($this->get($key) === $old) { |
152 | 152 | $result = self::$cache->multi() |
153 | - ->set($this->getNameSpace() . $key, $new) |
|
153 | + ->set($this->getNameSpace().$key, $new) |
|
154 | 154 | ->exec(); |
155 | 155 | return $result !== false; |
156 | 156 | } |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | * @return bool |
167 | 167 | */ |
168 | 168 | public function cad($key, $old) { |
169 | - self::$cache->watch($this->getNameSpace() . $key); |
|
169 | + self::$cache->watch($this->getNameSpace().$key); |
|
170 | 170 | if ($this->get($key) === $old) { |
171 | 171 | $result = self::$cache->multi() |
172 | - ->del($this->getNameSpace() . $key) |
|
172 | + ->del($this->getNameSpace().$key) |
|
173 | 173 | ->exec(); |
174 | 174 | return $result !== false; |
175 | 175 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | public function setTTL($key, $ttl) { |
181 | - self::$cache->expire($this->getNameSpace() . $key, $ttl); |
|
181 | + self::$cache->expire($this->getNameSpace().$key, $ttl); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | public static function isAvailable() { |