Added $ttl sanity check to WANObjectCache::delete()
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 19 Aug 2015 23:37:59 +0000 (16:37 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 19 Aug 2015 23:37:59 +0000 (16:37 -0700)
Change-Id: I48c80bd6ba5f79c94e87d75816f2e2069200c9aa

includes/libs/objectcache/WANObjectCache.php

index 36250b0..c541a9e 100644 (file)
@@ -272,6 +272,8 @@ class WANObjectCache {
         */
        final public function delete( $key, $ttl = self::HOLDOFF_TTL ) {
                $key = self::VALUE_KEY_PREFIX . $key;
+               // Avoid indefinite key salting for sanity
+               $ttl = max( $ttl, 1 );
                // Update the local cluster immediately
                $ok = $this->cache->set( $key, self::PURGE_VAL_PREFIX . microtime( true ), $ttl );
                // Publish the purge to all clusters