Skip to content

Commit

Permalink
Updated SemaphoresManager's lockingTime to seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
micheleangioni committed Mar 9, 2019
1 parent e9036c9 commit 98dd1a5
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/MicheleAngioni/Support/Semaphores/SemaphoresManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ class SemaphoresManager
protected $keyManager;

/**
* Minutes the semaphore remains locked before getting automatically unlocked.
* Seconds the semaphore remains locked before getting automatically unlocked.
*
* @var int
*/
protected $lockingTime = 2;
protected $lockingTime = 120;

/**
* Construct
*
* @param CacheInterface $cache
* @param KeyManagerInterface $keyManager
* @param CacheInterface $cache
* @param KeyManagerInterface $keyManager
*/
public function __construct(CacheInterface $cache, KeyManagerInterface $keyManager)
{
Expand All @@ -51,20 +51,19 @@ public function getLockingTime(): int
/**
* Set the locking time.
*
* @param int $minutes
*
* @param int $seconds
* @return int
*/
public function setLockingTime(int $minutes): int
public function setLockingTime(int $seconds): int
{
return $this->lockingTime = $minutes;
return $this->lockingTime = $seconds;
}

/**
* Return the key of the semaphore connected with input $id and $section.
*
* @param string|bool $id
* @param string $section
* @param string|bool $id
* @param string $section
*
* @return string
*/
Expand All @@ -76,8 +75,8 @@ public function getSemaphoreKey($id, string $section)
/**
* Check if a semaphore is locked or free. Return 1 if locked or 0 if unlocked.
*
* @param string $id
* @param string $section
* @param string $id
* @param string $section
*
* @return int
*/
Expand All @@ -95,8 +94,8 @@ public function checkIfSemaphoreIsLocked($id, string $section): int
/**
* Lock the semaphore with input key and section.
*
* @param string $id
* @param string $section
* @param string $id
* @param string $section
*/
public function lockSemaphore($id, string $section)
{
Expand All @@ -108,8 +107,8 @@ public function lockSemaphore($id, string $section)
/**
* Unlock the semaphore with input key and section.
*
* @param string $id
* @param string $section
* @param string $id
* @param string $section
*/
public function unlockSemaphore($id, string $section)
{
Expand Down

0 comments on commit 98dd1a5

Please sign in to comment.