Added cache locker

This commit is contained in:
RainLoop Team 2014-11-18 15:47:25 +04:00
parent 723e0afa4e
commit ebce312d1a
2 changed files with 58 additions and 5 deletions

View file

@ -65,6 +65,36 @@ class CacheClient
return $this->Set($sKey.'/TIMER', time());
}
/**
* @param string $sKey
*
* @return bool
*/
public function SetLock($sKey)
{
return $this->Set($sKey.'/LOCK', '1');
}
/**
* @param string $sKey
*
* @return bool
*/
public function RemoveLock($sKey)
{
return $this->Set($sKey.'/LOCK', '0');
}
/**
* @param string $sKey
*
* @return bool
*/
public function GetLock($sKey)
{
return '1' === $this->Get($sKey.'/LOCK');
}
/**
* @param string $sKey
* @param string $bClearAfterGet = false