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