@@ 90-105 (lines=16) @@ | ||
87 | $this->attrMap[self::ATTR_SYNCWRITES] = self::QOS_SYNCWRITES_NONE; |
|
88 | } |
|
89 | ||
90 | protected function doGet( $key, $flags = 0 ) { |
|
91 | list( $server, $conn ) = $this->getConnection( $key ); |
|
92 | if ( !$conn ) { |
|
93 | return false; |
|
94 | } |
|
95 | try { |
|
96 | $value = $conn->get( $key ); |
|
97 | $result = $this->unserialize( $value ); |
|
98 | } catch ( RedisException $e ) { |
|
99 | $result = false; |
|
100 | $this->handleException( $conn, $e ); |
|
101 | } |
|
102 | ||
103 | $this->logRequest( 'get', $key, $server, $result ); |
|
104 | return $result; |
|
105 | } |
|
106 | ||
107 | public function set( $key, $value, $expiry = 0, $flags = 0 ) { |
|
108 | list( $server, $conn ) = $this->getConnection( $key ); |
|
@@ 272-290 (lines=19) @@ | ||
269 | * @param int $value Value to add to $key (Default 1) |
|
270 | * @return int|bool New value or false on failure |
|
271 | */ |
|
272 | public function incr( $key, $value = 1 ) { |
|
273 | list( $server, $conn ) = $this->getConnection( $key ); |
|
274 | if ( !$conn ) { |
|
275 | return false; |
|
276 | } |
|
277 | try { |
|
278 | if ( !$conn->exists( $key ) ) { |
|
279 | return null; |
|
280 | } |
|
281 | // @FIXME: on races, the key may have a 0 TTL |
|
282 | $result = $conn->incrBy( $key, $value ); |
|
283 | } catch ( RedisException $e ) { |
|
284 | $result = false; |
|
285 | $this->handleException( $conn, $e ); |
|
286 | } |
|
287 | ||
288 | $this->logRequest( 'incr', $key, $server, $result ); |
|
289 | return $result; |
|
290 | } |
|
291 | ||
292 | public function changeTTL( $key, $expiry = 0 ) { |
|
293 | list( $server, $conn ) = $this->getConnection( $key ); |
|
@@ 292-308 (lines=17) @@ | ||
289 | return $result; |
|
290 | } |
|
291 | ||
292 | public function changeTTL( $key, $expiry = 0 ) { |
|
293 | list( $server, $conn ) = $this->getConnection( $key ); |
|
294 | if ( !$conn ) { |
|
295 | return false; |
|
296 | } |
|
297 | ||
298 | $expiry = $this->convertToRelative( $expiry ); |
|
299 | try { |
|
300 | $result = $conn->expire( $key, $expiry ); |
|
301 | } catch ( RedisException $e ) { |
|
302 | $result = false; |
|
303 | $this->handleException( $conn, $e ); |
|
304 | } |
|
305 | ||
306 | $this->logRequest( 'expire', $key, $server, $result ); |
|
307 | return $result; |
|
308 | } |
|
309 | ||
310 | public function modifySimpleRelayEvent( array $event ) { |
|
311 | if ( array_key_exists( 'val', $event ) ) { |