mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-09 21:14:33 +02:00
code standards / simplifications
This commit is contained in:
parent
19209f6826
commit
906bb25972
18 changed files with 70 additions and 121 deletions
|
@ -14,11 +14,7 @@ class SemaphoreLockDriver extends AbstractLockDriver
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a semaphore key
|
||||
*
|
||||
* @param string $key Name of the lock
|
||||
*
|
||||
* @return integer the semaphore key
|
||||
* (@inheritdoc)
|
||||
*/
|
||||
private static function semaphoreKey($key)
|
||||
{
|
||||
|
@ -35,14 +31,9 @@ class SemaphoreLockDriver extends AbstractLockDriver
|
|||
|
||||
/**
|
||||
*
|
||||
* @brief Sets a lock for a given name
|
||||
*
|
||||
* @param string $key The Name of the lock
|
||||
* @param integer $timeout Seconds until we give up
|
||||
*
|
||||
* @return boolean Was the lock successful?
|
||||
* (@inheritdoc)
|
||||
*/
|
||||
public function acquireLock($key, $timeout = 120)
|
||||
public function acquire($key, $timeout = 120)
|
||||
{
|
||||
self::$semaphore[$key] = sem_get(self::semaphoreKey($key));
|
||||
if (self::$semaphore[$key]) {
|
||||
|
@ -56,13 +47,9 @@ class SemaphoreLockDriver extends AbstractLockDriver
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Removes a lock if it was set by us
|
||||
*
|
||||
* @param string $key Name of the lock
|
||||
*
|
||||
* @return mixed
|
||||
* (@inheritdoc)
|
||||
*/
|
||||
public function releaseLock($key)
|
||||
public function release($key)
|
||||
{
|
||||
if (empty(self::$semaphore[$key])) {
|
||||
return false;
|
||||
|
@ -75,10 +62,7 @@ class SemaphoreLockDriver extends AbstractLockDriver
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Checks, if a key is currently locked to a process
|
||||
*
|
||||
* @param string $key The name of the lock
|
||||
* @return bool
|
||||
* (@inheritdoc)
|
||||
*/
|
||||
public function isLocked($key)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue