Deleting parameter-types of methods (lack of support in PHP 5.6)
This commit is contained in:
parent
4b7be15560
commit
ad5ee75159
6 changed files with 13 additions and 13 deletions
|
@ -20,7 +20,7 @@ class CacheDriverFactory
|
||||||
* @return ICacheDriver The instance of the CacheDriver
|
* @return ICacheDriver The instance of the CacheDriver
|
||||||
* @throws \Exception The exception if something went wrong during the CacheDriver creation
|
* @throws \Exception The exception if something went wrong during the CacheDriver creation
|
||||||
*/
|
*/
|
||||||
public static function create(string $driver) {
|
public static function create($driver) {
|
||||||
|
|
||||||
switch ($driver) {
|
switch ($driver) {
|
||||||
case 'memcache':
|
case 'memcache':
|
||||||
|
|
|
@ -22,7 +22,7 @@ abstract class AbstractLockDriver implements ILockDriver
|
||||||
* @param string key The Name of the lock
|
* @param string key The Name of the lock
|
||||||
* @return bool Returns true if the lock is set
|
* @return bool Returns true if the lock is set
|
||||||
*/
|
*/
|
||||||
protected function hasAcquiredLock(string $key) {
|
protected function hasAcquiredLock($key) {
|
||||||
return isset($this->acquireLock[$key]);
|
return isset($this->acquireLock[$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ abstract class AbstractLockDriver implements ILockDriver
|
||||||
*
|
*
|
||||||
* @param string $key The Name of the lock
|
* @param string $key The Name of the lock
|
||||||
*/
|
*/
|
||||||
protected function markAcquire(string $key) {
|
protected function markAcquire($key) {
|
||||||
$this->acquiredLocks[$key] = true;
|
$this->acquiredLocks[$key] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ abstract class AbstractLockDriver implements ILockDriver
|
||||||
*
|
*
|
||||||
* @param string $key The Name of the lock
|
* @param string $key The Name of the lock
|
||||||
*/
|
*/
|
||||||
protected function markRelease(string $key) {
|
protected function markRelease($key) {
|
||||||
unset($this->acquiredLocks[$key]);
|
unset($this->acquiredLocks[$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class CacheLockDriver extends AbstractLockDriver
|
||||||
*
|
*
|
||||||
* @return boolean Was the lock successful?
|
* @return boolean Was the lock successful?
|
||||||
*/
|
*/
|
||||||
public function acquireLock(string $key, int $timeout = 120)
|
public function acquireLock($key, $timeout = 120)
|
||||||
{
|
{
|
||||||
$got_lock = false;
|
$got_lock = false;
|
||||||
$start = time();
|
$start = time();
|
||||||
|
@ -71,7 +71,7 @@ class CacheLockDriver extends AbstractLockDriver
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function releaseLock(string $key)
|
public function releaseLock($key)
|
||||||
{
|
{
|
||||||
$cachekey = get_app()->get_hostname() . ";lock:" . $key;
|
$cachekey = get_app()->get_hostname() . ";lock:" . $key;
|
||||||
$lock = $this->cache->get($cachekey);
|
$lock = $this->cache->get($cachekey);
|
||||||
|
|
|
@ -18,7 +18,7 @@ class DatabaseLockDriver extends AbstractLockDriver
|
||||||
*
|
*
|
||||||
* @return boolean Was the lock successful?
|
* @return boolean Was the lock successful?
|
||||||
*/
|
*/
|
||||||
public function acquireLock(string $key, int $timeout = 120)
|
public function acquireLock($key, $timeout = 120)
|
||||||
{
|
{
|
||||||
$got_lock = false;
|
$got_lock = false;
|
||||||
$start = time();
|
$start = time();
|
||||||
|
@ -66,7 +66,7 @@ class DatabaseLockDriver extends AbstractLockDriver
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function releaseLock(string $key)
|
public function releaseLock($key)
|
||||||
{
|
{
|
||||||
dba::delete('locks', ['locked' => false, 'pid' => 0], ['name' => $key, 'pid' => getmypid()]);
|
dba::delete('locks', ['locked' => false, 'pid' => 0], ['name' => $key, 'pid' => getmypid()]);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ interface ILockDriver
|
||||||
*
|
*
|
||||||
* @return boolean Was the lock successful?
|
* @return boolean Was the lock successful?
|
||||||
*/
|
*/
|
||||||
public function acquireLock(string $key, int $timeout = 120);
|
public function acquireLock($key, $timeout = 120);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Releases a lock if it was set by us
|
* @brief Releases a lock if it was set by us
|
||||||
|
@ -27,7 +27,7 @@ interface ILockDriver
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function releaseLock(string $key);
|
public function releaseLock($key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Releases all lock that were set by us
|
* @brief Releases all lock that were set by us
|
||||||
|
|
|
@ -18,7 +18,7 @@ class SemaphoreLockDriver extends AbstractLockDriver
|
||||||
*
|
*
|
||||||
* @return integer the semaphore key
|
* @return integer the semaphore key
|
||||||
*/
|
*/
|
||||||
private static function semaphoreKey(string $key)
|
private static function semaphoreKey($key)
|
||||||
{
|
{
|
||||||
$temp = get_temppath();
|
$temp = get_temppath();
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class SemaphoreLockDriver extends AbstractLockDriver
|
||||||
*
|
*
|
||||||
* @return boolean Was the lock successful?
|
* @return boolean Was the lock successful?
|
||||||
*/
|
*/
|
||||||
public function acquireLock(string $key, int $timeout = 120)
|
public function acquireLock($key, $timeout = 120)
|
||||||
{
|
{
|
||||||
$this->acquiredLocks[$key] = sem_get(self::semaphoreKey($key));
|
$this->acquiredLocks[$key] = sem_get(self::semaphoreKey($key));
|
||||||
if ($this->acquiredLocks[$key]) {
|
if ($this->acquiredLocks[$key]) {
|
||||||
|
@ -55,7 +55,7 @@ class SemaphoreLockDriver extends AbstractLockDriver
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function releaseLock(string $key)
|
public function releaseLock($key)
|
||||||
{
|
{
|
||||||
if (empty($this->acquiredLocks[$key])) {
|
if (empty($this->acquiredLocks[$key])) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue