@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function clear() |
144 | 144 | { |
145 | - if (isset($this->config[ 'dbIndex' ])) { |
|
145 | + if (isset($this->config['dbIndex'])) { |
|
146 | 146 | return $this->redis->flushDB(); |
147 | 147 | } else { |
148 | 148 | return $this->redis->flushAll(); |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | public function save(CacheItemInterface $item) |
192 | 192 | { |
193 | 193 | $metadata = $item->getMetadata(); |
194 | - $metadata[ 'data' ] = $item->get(); |
|
194 | + $metadata['data'] = $item->get(); |
|
195 | 195 | |
196 | - if ( ! $this->redis->set($this->prefixKey . $item->getKey(), serialize($metadata), $metadata[ 'ttl' ])) { |
|
196 | + if ( ! $this->redis->set($this->prefixKey . $item->getKey(), serialize($metadata), $metadata['ttl'])) { |
|
197 | 197 | return false; |
198 | - } elseif ($metadata[ 'ttl' ] > 0) { |
|
199 | - $this->redis->expireAt($this->prefixKey . $item->getKey(), $metadata[ 'etime' ]); |
|
198 | + } elseif ($metadata['ttl'] > 0) { |
|
199 | + $this->redis->expireAt($this->prefixKey . $item->getKey(), $metadata['etime']); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | return true; |
@@ -71,20 +71,20 @@ |
||
71 | 71 | |
72 | 72 | try { |
73 | 73 | if ( ! $this->redis->connect( |
74 | - $this->config[ 'host' ], |
|
75 | - ($this->config[ 'host' ][ 0 ] === '/' ? 0 |
|
76 | - : $this->config[ 'port' ]), |
|
77 | - $this->config[ 'timeout' ] |
|
74 | + $this->config['host'], |
|
75 | + ($this->config['host'][0] === '/' ? 0 |
|
76 | + : $this->config['port']), |
|
77 | + $this->config['timeout'] |
|
78 | 78 | ) |
79 | 79 | ) { |
80 | 80 | throw new RuntimeException('CACHE_REDIS_E_CONNECTION_FAILED'); |
81 | 81 | } |
82 | 82 | |
83 | - if (isset($this->config[ 'password' ]) AND ! $this->redis->auth($this->config[ 'password' ])) { |
|
83 | + if (isset($this->config['password']) AND ! $this->redis->auth($this->config['password'])) { |
|
84 | 84 | throw new DomainException('CACHE_REDIS_E_AUTHENTICATION_FAILED'); |
85 | 85 | } |
86 | 86 | |
87 | - if (isset($this->config[ 'dbIndex' ]) AND ! $this->redis->select($this->config[ 'dbIndex' ])) { |
|
87 | + if (isset($this->config['dbIndex']) AND ! $this->redis->select($this->config['dbIndex'])) { |
|
88 | 88 | throw new RuntimeException('CACHE_REDIS_E_DB_CONNECTION_FAILED'); |
89 | 89 | } |
90 | 90 | } catch (\RedisException $e) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $apcIterator = new \APCUIterator(); |
56 | 56 | |
57 | 57 | foreach ($apcIterator as $item) { |
58 | - $items[] = new Item(str_replace($this->prefixKey, '', $item[ 'key' ]), $item[ 'value' ]); |
|
58 | + $items[] = new Item(str_replace($this->prefixKey, '', $item['key']), $item['value']); |
|
59 | 59 | } |
60 | 60 | } elseif (count($keys)) { |
61 | 61 | foreach ($keys as $key) { |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | public function save(CacheItemInterface $item) |
187 | 187 | { |
188 | 188 | $metadata = $item->getMetadata(); |
189 | - $metadata[ 'data' ] = $item->get(); |
|
189 | + $metadata['data'] = $item->get(); |
|
190 | 190 | |
191 | - return apcu_store($this->prefixKey . $item->getKey(), $metadata, $metadata[ 'ttl' ]); |
|
191 | + return apcu_store($this->prefixKey . $item->getKey(), $metadata, $metadata['ttl']); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | \ No newline at end of file |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | if (empty($keys)) { |
57 | 57 | $ucacheInfo = wincache_ucache_info(false); |
58 | 58 | |
59 | - foreach ($ucacheInfo[ 'ucache_entries' ] as $item) { |
|
60 | - $items[] = $this->getItem(str_replace($this->prefixKey, '', $item[ 'key_name' ])); |
|
59 | + foreach ($ucacheInfo['ucache_entries'] as $item) { |
|
60 | + $items[] = $this->getItem(str_replace($this->prefixKey, '', $item['key_name'])); |
|
61 | 61 | } |
62 | 62 | } elseif (count($keys)) { |
63 | 63 | foreach ($keys as $key) { |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | public function save(CacheItemInterface $item) |
189 | 189 | { |
190 | 190 | $metadata = $item->getMetadata(); |
191 | - $metadata[ 'data' ] = $item->get(); |
|
191 | + $metadata['data'] = $item->get(); |
|
192 | 192 | |
193 | - return wincache_ucache_set($this->prefixKey . $item->getKey(), $metadata, $metadata[ 'ttl' ]); |
|
193 | + return wincache_ucache_set($this->prefixKey . $item->getKey(), $metadata, $metadata['ttl']); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | \ No newline at end of file |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | |
59 | 59 | foreach ($allItems as $allItem) { |
60 | 60 | foreach ($allItem as $item) { |
61 | - if (isset($item[ 'name' ])) { |
|
62 | - $items[] = $this->getItem(str_replace($this->prefixKey, '', $item[ 'name' ])); |
|
61 | + if (isset($item['name'])) { |
|
62 | + $items[] = $this->getItem(str_replace($this->prefixKey, '', $item['name'])); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | } |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | public function save(CacheItemInterface $item) |
191 | 191 | { |
192 | 192 | $metadata = $item->getMetadata(); |
193 | - $metadata[ 'data' ] = $item->get(); |
|
193 | + $metadata['data'] = $item->get(); |
|
194 | 194 | |
195 | - return xcache_set($this->prefixKey . $item->getKey(), $metadata, $metadata[ 'ttl' ]); |
|
195 | + return xcache_set($this->prefixKey . $item->getKey(), $metadata, $metadata['ttl']); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | \ No newline at end of file |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | foreach ($storage as $key => $item) { |
93 | 93 | if ($this->save($item) === true) { |
94 | - unset($storage[ $key ]); |
|
94 | + unset($storage[$key]); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | foreach ($keys as $key) { |
127 | 127 | if ($this->has($key)) { |
128 | - $result[ $key ] = $this->get($key, $default); |
|
128 | + $result[$key] = $this->get($key, $default); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | foreach ($values as $key => $value) { |
200 | 200 | if ($this->set($key, $value, $ttl)) { |
201 | - $result[ $key ] = true; |
|
201 | + $result[$key] = true; |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 |
@@ -95,11 +95,11 @@ |
||
95 | 95 | $this->key = $key; |
96 | 96 | |
97 | 97 | // Set from item metadata |
98 | - if (isset($value[ 'ctime' ]) AND isset($value[ 'etime' ]) AND isset($value[ 'ttl' ]) AND isset($value[ 'data' ])) { |
|
99 | - $this->set($value[ 'data' ]); |
|
100 | - $this->createdAt = new \DateTime(date('r', $value[ 'ctime' ])); |
|
101 | - $this->expiresAt = new \DateTime(date('r', $value[ 'etime' ])); |
|
102 | - $this->expiresAfter($value[ 'ttl' ]); |
|
98 | + if (isset($value['ctime']) AND isset($value['etime']) AND isset($value['ttl']) AND isset($value['data'])) { |
|
99 | + $this->set($value['data']); |
|
100 | + $this->createdAt = new \DateTime(date('r', $value['ctime'])); |
|
101 | + $this->expiresAt = new \DateTime(date('r', $value['etime'])); |
|
102 | + $this->expiresAfter($value['ttl']); |
|
103 | 103 | } else { |
104 | 104 | // Set item value |
105 | 105 | $this->set($value); |