From 42bf202b19fce5a4726a6f8aeef0bccda2234096 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 15 May 2015 15:55:09 -0700 Subject: [PATCH] Added RedisBagOStuff FIXME comments Change-Id: I6f4f85166584439a38d632356f3ed95e4fd4fd6f --- includes/objectcache/RedisBagOStuff.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/objectcache/RedisBagOStuff.php b/includes/objectcache/RedisBagOStuff.php index 9d5d0ef0a1..ed0aaa2368 100644 --- a/includes/objectcache/RedisBagOStuff.php +++ b/includes/objectcache/RedisBagOStuff.php @@ -264,8 +264,6 @@ class RedisBagOStuff extends BagOStuff { return $result; } - - public function add( $key, $value, $expiry = 0 ) { list( $server, $conn ) = $this->getConnection( $key ); @@ -277,6 +275,7 @@ class RedisBagOStuff extends BagOStuff { if ( $expiry ) { $conn->multi(); $conn->setnx( $key, $this->serialize( $value ) ); + // @FIXME: this always bumps the TTL; use Redis 2.8 or Lua $conn->expire( $key, $expiry ); $result = ( $conn->exec() == array( true, true ) ); } else { @@ -313,6 +312,7 @@ class RedisBagOStuff extends BagOStuff { return null; } try { + // @FIXME: on races, the key may have a 0 TTL $result = $conn->incrBy( $key, $value ); } catch ( RedisException $e ) { $result = false; -- 2.20.1