Ejemplo n.º 1
0
 /**
  * @covers BagOStuff::incr
  */
 public function testIncr()
 {
     $key = wfMemcKey('test');
     $this->cache->add($key, 0);
     $this->cache->incr($key);
     $expectedValue = 1;
     $actualValue = $this->cache->get($key);
     $this->assertEquals($expectedValue, $actualValue, 'Value should be 1 after incrementing');
 }
Ejemplo n.º 2
0
 /**
  * Log a lock request failure to the cache
  *
  * @param $lockDb string
  * @return bool Success
  */
 protected function cacheRecordFailure($lockDb)
 {
     if ($this->statusCache && $this->safeDelay > 0) {
         $path = $this->getMissKey($lockDb);
         $misses = $this->statusCache->get($path);
         if ($misses) {
             return $this->statusCache->incr($path);
         } else {
             return $this->statusCache->add($path, 1, $this->safeDelay);
         }
     }
     return true;
 }
Ejemplo n.º 3
0
 public function incr($key, $value = 1)
 {
     return $this->writeStore->incr($key, $value);
 }