@@ -24,18 +24,18 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function __construct(array $config) |
| 26 | 26 | { |
| 27 | - $this->handler= new \Redis(); |
|
| 28 | - $redisConfig= $this::$defaults; |
|
| 27 | + $this->handler = new \Redis(); |
|
| 28 | + $redisConfig = $this::$defaults; |
|
| 29 | 29 | foreach ($config as $key=>$value) { |
| 30 | 30 | $redisConfig[$key] = $value; |
| 31 | 31 | } |
| 32 | - if ( isset($redisConfig['persistent']) && ($redisConfig['persistent'] === true)) { |
|
| 32 | + if (isset($redisConfig['persistent']) && ($redisConfig['persistent'] === true)) { |
|
| 33 | 33 | return $this->connect($redisConfig); |
| 34 | 34 | } |
| 35 | 35 | return $this->persistentConnect($redisConfig); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - private function connect( array $redisConfig){ |
|
| 38 | + private function connect(array $redisConfig) { |
|
| 39 | 39 | $this->handler->connect( |
| 40 | 40 | $redisConfig['host'], |
| 41 | 41 | $redisConfig['port'], |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $this->handler->select($redisConfig['dbIndex']); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - private function persistentConnect( array $redisConfig){ |
|
| 49 | + private function persistentConnect(array $redisConfig) { |
|
| 50 | 50 | $this->handler->pconnect( |
| 51 | 51 | $redisConfig['host'], |
| 52 | 52 | $redisConfig['port'], |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @return bool True on success and false on failure |
| 81 | 81 | */ |
| 82 | - public function set($key, $value, $ttl = null){ |
|
| 82 | + public function set($key, $value, $ttl = null) { |
|
| 83 | 83 | $ttl = intval($ttl); |
| 84 | - if($ttl ==0 ){ |
|
| 84 | + if ($ttl == 0) { |
|
| 85 | 85 | return $this->handler->set($key, $value); |
| 86 | 86 | } |
| 87 | 87 | return $this->handler->set($key, $value, $ttl); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | * @return bool True on success and false on failure |
| 95 | 95 | */ |
| 96 | - public function delete($key){ |
|
| 96 | + public function delete($key) { |
|
| 97 | 97 | return (bool) $this->handler->delete($key); |
| 98 | 98 | } |
| 99 | 99 | /** |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @return bool True on success and false on failure |
| 103 | 103 | */ |
| 104 | - public function clear(){ |
|
| 104 | + public function clear() { |
|
| 105 | 105 | return $this->handler->flushDb(); |
| 106 | 106 | } |
| 107 | 107 | /** |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | return $this->handler->mSet($items); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $return =[]; |
|
| 133 | + $return = []; |
|
| 134 | 134 | foreach ($items as $key=>$value) { |
| 135 | - $return[$key] = $this->set($key, $value, $ttl); |
|
| 135 | + $return[$key] = $this->set($key, $value, $ttl); |
|
| 136 | 136 | } |
| 137 | 137 | return $return; |
| 138 | 138 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function deleteMultiple($keys) |
| 147 | 147 | { |
| 148 | - $return =[]; |
|
| 148 | + $return = []; |
|
| 149 | 149 | foreach ($keys as $key) { |
| 150 | 150 | $return[$key] = (bool) $this->delete($key); |
| 151 | 151 | } |