1
0
Fork 0

Refactor Cache/Lock to DICE

- Refactor Cache classes
- Refactor Lock classes
- Improved test speed (removed some seperate class annotations)
This commit is contained in:
Philipp Holzer 2019-08-03 20:48:56 +02:00
commit d56bd28a07
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
40 changed files with 766 additions and 621 deletions

View file

@ -1,6 +1,7 @@
<?php
namespace Friendica\Core\Lock;
use Friendica\Core\Cache;
/**
@ -13,7 +14,8 @@ interface ILockDriver
/**
* Checks, if a key is currently locked to a or my process
*
* @param string $key The name of the lock
* @param string $key The name of the lock
*
* @return bool
*/
public function isLocked($key);
@ -22,13 +24,13 @@ interface ILockDriver
*
* Acquires a lock for a given name
*
* @param string $key The Name of the lock
* @param integer $timeout Seconds until we give up
* @param integer $ttl Seconds The lock lifespan, must be one of the Cache constants
* @param string $key The Name of the lock
* @param integer $timeout Seconds until we give up
* @param integer $ttl Seconds The lock lifespan, must be one of the Cache constants
*
* @return boolean Was the lock successful?
*/
public function acquireLock($key, $timeout = 120, $ttl = Cache::FIVE_MINUTES);
public function acquireLock($key, $timeout = 120, $ttl = Cache\ICacheDriver::FIVE_MINUTES);
/**
* Releases a lock if it was set by us