- fixed test for semaphore
- fixed some issues
- changed namespace in Tests back to "src/"
- changed namings
This commit is contained in:
Philipp Holzer 2018-07-05 20:57:31 +02:00
parent 906bb25972
commit e41e7d2edd
No known key found for this signature in database
GPG key ID: 58160D7D6AF942B6
15 changed files with 67 additions and 65 deletions

View file

@ -20,7 +20,7 @@ class SemaphoreLockDriver extends AbstractLockDriver
{
$temp = get_temppath();
$file = $temp.'/'.$key.'.sem';
$file = $temp . '/' . $key . '.sem';
if (!file_exists($file)) {
file_put_contents($file, $key);
@ -33,7 +33,7 @@ class SemaphoreLockDriver extends AbstractLockDriver
*
* (@inheritdoc)
*/
public function acquire($key, $timeout = 120)
public function acquireLock($key, $timeout = 120)
{
self::$semaphore[$key] = sem_get(self::semaphoreKey($key));
if (self::$semaphore[$key]) {
@ -49,7 +49,7 @@ class SemaphoreLockDriver extends AbstractLockDriver
/**
* (@inheritdoc)
*/
public function release($key)
public function releaseLock($key)
{
if (empty(self::$semaphore[$key])) {
return false;
@ -66,6 +66,6 @@ class SemaphoreLockDriver extends AbstractLockDriver
*/
public function isLocked($key)
{
return @sem_get(self::$semaphore[$key]) !== false;
return isset(self::$semaphore[$key]);
}
}