X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FLock.php;h=a45490bf3966065990476741e64340910bb78582;hb=fb63274aafa176ee2eff964e809306719e80c847;hp=9892f1f4e4d7e74e2dcab9212da8a09f4943401f;hpb=3eec97aa6e84961c8d2ce2ea3f47d92f0e4bdb4f;p=friendica.git diff --git a/src/Core/Lock.php b/src/Core/Lock.php index 9892f1f4e4..a45490bf39 100644 --- a/src/Core/Lock.php +++ b/src/Core/Lock.php @@ -1,13 +1,13 @@ 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); } /**