* @return ICacheDriver The instance of the CacheDriver
* @throws \Exception The exception if something went wrong during the CacheDriver creation
*/
- public static function create(string $driver) {
+ public static function create($driver) {
switch ($driver) {
case 'memcache':
* @param string key The Name of the lock
* @return bool Returns true if the lock is set
*/
- protected function hasAcquiredLock(string $key) {
+ protected function hasAcquiredLock($key) {
return isset($this->acquireLock[$key]);
}
*
* @param string $key The Name of the lock
*/
- protected function markAcquire(string $key) {
+ protected function markAcquire($key) {
$this->acquiredLocks[$key] = true;
}
*
* @param string $key The Name of the lock
*/
- protected function markRelease(string $key) {
+ protected function markRelease($key) {
unset($this->acquiredLocks[$key]);
}
*
* @return boolean Was the lock successful?
*/
- public function acquireLock(string $key, int $timeout = 120)
+ public function acquireLock($key, $timeout = 120)
{
$got_lock = false;
$start = time();
*
* @return mixed
*/
- public function releaseLock(string $key)
+ public function releaseLock($key)
{
$cachekey = get_app()->get_hostname() . ";lock:" . $key;
$lock = $this->cache->get($cachekey);
*
* @return boolean Was the lock successful?
*/
- public function acquireLock(string $key, int $timeout = 120)
+ public function acquireLock($key, $timeout = 120)
{
$got_lock = false;
$start = time();
*
* @return mixed
*/
- public function releaseLock(string $key)
+ public function releaseLock($key)
{
dba::delete('locks', ['locked' => false, 'pid' => 0], ['name' => $key, 'pid' => getmypid()]);
*
* @return boolean Was the lock successful?
*/
- public function acquireLock(string $key, int $timeout = 120);
+ public function acquireLock($key, $timeout = 120);
/**
* @brief Releases a lock if it was set by us
*
* @return void
*/
- public function releaseLock(string $key);
+ public function releaseLock($key);
/**
* @brief Releases all lock that were set by us
*
* @return integer the semaphore key
*/
- private static function semaphoreKey(string $key)
+ private static function semaphoreKey($key)
{
$temp = get_temppath();
*
* @return boolean Was the lock successful?
*/
- public function acquireLock(string $key, int $timeout = 120)
+ public function acquireLock($key, $timeout = 120)
{
$this->acquiredLocks[$key] = sem_get(self::semaphoreKey($key));
if ($this->acquiredLocks[$key]) {
*
* @return mixed
*/
- public function releaseLock(string $key)
+ public function releaseLock($key)
{
if (empty($this->acquiredLocks[$key])) {
return false;