X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FLock.php;h=a45490bf3966065990476741e64340910bb78582;hb=7c10807d1d1dd97c04ab5c4498246bcaff064a8f;hp=4a737e3814a574629809e42db428af818094cc65;hpb=c6ce9ddaa41a59496cbe5cd93ace9bc552478ccd;p=friendica.git diff --git a/src/Core/Lock.php b/src/Core/Lock.php index 4a737e3814..a45490bf39 100644 --- a/src/Core/Lock.php +++ b/src/Core/Lock.php @@ -1,14 +1,13 @@ getMessage()); + Logger::log('Using Semaphore driver for locking failed: ' . $exception->getMessage()); } } @@ -111,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); } /**