X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FLock.php;h=8bc2c242d18a588d984bb10be0c8daebd4e8e69e;hb=b06fc578804fdc0073631e7c97eccd25543e769e;hp=9892f1f4e4d7e74e2dcab9212da8a09f4943401f;hpb=71ec84f6dc83f753fe80170cfdfd32d202850d90;p=friendica.git diff --git a/src/Core/Lock.php b/src/Core/Lock.php index 9892f1f4e4..8bc2c242d1 100644 --- a/src/Core/Lock.php +++ b/src/Core/Lock.php @@ -1,12 +1,12 @@ getMessage()); + Logger::log('Using Semaphore driver for locking failed: ' . $exception->getMessage()); } } @@ -83,7 +83,7 @@ class Lock } return; } catch (\Exception $exception) { - logger('Using Cache driver for locking failed: ' . $exception->getMessage()); + Logger::log('Using Cache driver for locking failed: ' . $exception->getMessage()); } } @@ -110,23 +110,25 @@ class Lock * * @param string $key Name of the lock * @param integer $timeout Seconds until we give up + * @param integer $ttl The Lock lifespan, must be one of the Cache constants * * @return boolean Was the lock successful? */ - public static function acquire($key, $timeout = 120) + public static function acquire($key, $timeout = 120, $ttl = Cache::FIVE_MINUTES) { - return self::getDriver()->acquireLock($key, $timeout); + return self::getDriver()->acquireLock($key, $timeout, $ttl); } /** * @brief Releases a lock if it was set by us * - * @param string $key Name of the lock + * @param string $key Name of the lock + * @param bool $override Overrides the lock to get releases * @return void */ - public static function release($key) + public static function release($key, $override = false) { - self::getDriver()->releaseLock($key); + self::getDriver()->releaseLock($key, $override); } /**