| @@ 117-124 (lines=8) @@ | ||
| 114 | * @return mixed |
|
| 115 | * @throws Exception |
|
| 116 | */ |
|
| 117 | public function get($key) |
|
| 118 | { |
|
| 119 | if (!$this->isAvailable()) { |
|
| 120 | throw new Exception('Memcached is not available'); |
|
| 121 | } |
|
| 122 | $key = $this->getCacheKey($key); |
|
| 123 | return $this->getMemcachedInstance()->get($key); |
|
| 124 | } |
|
| 125 | ||
| 126 | /** |
|
| 127 | * Define a |
|
| @@ 155-165 (lines=11) @@ | ||
| 152 | * @return $this |
|
| 153 | * @throws Exception |
|
| 154 | */ |
|
| 155 | public function remove($key) |
|
| 156 | { |
|
| 157 | if (!$this->isAvailable()) { |
|
| 158 | throw new Exception('Memcached is not available'); |
|
| 159 | } |
|
| 160 | $key = $this->getCacheKey($key); |
|
| 161 | if (!$this->getMemcachedInstance()->delete($key)) { |
|
| 162 | throw new Exception('Error while deleting key in memcached'); |
|
| 163 | } |
|
| 164 | return $this; |
|
| 165 | } |
|
| 166 | ||
| 167 | /** |
|
| 168 | * Define a setting |
|
| @@ 161-171 (lines=11) @@ | ||
| 158 | * @return $this |
|
| 159 | * @throws Exception |
|
| 160 | */ |
|
| 161 | public function remove($key) |
|
| 162 | { |
|
| 163 | if (!$this->isAvailable()) { |
|
| 164 | throw new Exception('Redis is not available'); |
|
| 165 | } |
|
| 166 | $key = $this->getCacheKey($key); |
|
| 167 | if (!$this->getRedisInstance()->del(array($key))) { |
|
| 168 | throw new Exception('Error while deleting key in redis'); |
|
| 169 | } |
|
| 170 | return $this; |
|
| 171 | } |
|
| 172 | ||
| 173 | /** |
|
| 174 | * Define a setting |
|