Implement RedisCacheSource::flushAll()
authorMaximilian Mader <max@bastelstu.be>
Wed, 31 Dec 2014 15:59:04 +0000 (16:59 +0100)
committerMaximilian Mader <max@bastelstu.be>
Fri, 29 May 2015 01:49:01 +0000 (03:49 +0200)
wcfsetup/install/files/lib/system/cache/source/RedisCacheSource.class.php

index aac947eab8d329f29a3fccb69c40cb1bf02efdb4..597f2fb233a692c8572a4064c5119b1d8d826412 100644 (file)
@@ -73,7 +73,11 @@ class RedisCacheSource implements ICacheSource {
         * @see \wcf\system\cache\source\ICacheSource::flushAll()
         */
        public function flushAll() {
+               // set flush key to current time if it does not exist yet (this prevents falling back to 0 if the key gets deleted)
+               $this->redis->setnx('_flush', TIME_NOW);
                
+               // atomic increment of flush count
+               $this->redis->incr('_flush');
        }
        
        /**