X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FLock.php;h=a45490bf3966065990476741e64340910bb78582;hb=7c10807d1d1dd97c04ab5c4498246bcaff064a8f;hp=7235c64a982aa3a9e2ec1e6f35f013652655a9ea;hpb=aac94d1d7445f2287f89a3559f4b3988e39edbdb;p=friendica.git diff --git a/src/Core/Lock.php b/src/Core/Lock.php index 7235c64a98..a45490bf39 100644 --- a/src/Core/Lock.php +++ b/src/Core/Lock.php @@ -1,15 +1,13 @@ getMessage()); + Logger::log('Using Semaphore driver for locking failed: ' . $exception->getMessage()); } } @@ -97,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()); } } @@ -124,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 acquireLock($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 - * @return mixed + * @param string $key Name of the lock + * @param bool $override Overrides the lock to get releases + * @return void */ - public static function releaseLock($key) + public static function release($key, $override = false) { - return self::getDriver()->releaseLock($key); + self::getDriver()->releaseLock($key, $override); } /**