mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-10 09:04:26 +02:00
Bugfixings for Cache-Lock
- used wrong cachekey in set - therefore added an abstraction to avoid wrong key concatenation - forgot to increase the db-version to 1275
This commit is contained in:
parent
3be013361e
commit
34cea93a8b
7 changed files with 72 additions and 35 deletions
|
@ -29,7 +29,7 @@ class CacheLockDriver extends AbstractLockDriver
|
|||
$got_lock = false;
|
||||
$start = time();
|
||||
|
||||
$cachekey = self::getCacheKey($key);
|
||||
$cachekey = self::getLockKey($key);
|
||||
|
||||
do {
|
||||
$lock = $this->cache->get($cachekey);
|
||||
|
@ -62,7 +62,7 @@ class CacheLockDriver extends AbstractLockDriver
|
|||
*/
|
||||
public function releaseLock($key)
|
||||
{
|
||||
$cachekey = self::getCacheKey($key);
|
||||
$cachekey = self::getLockKey($key);
|
||||
|
||||
$this->cache->compareDelete($cachekey, getmypid());
|
||||
$this->markRelease($key);
|
||||
|
@ -73,7 +73,7 @@ class CacheLockDriver extends AbstractLockDriver
|
|||
*/
|
||||
public function isLocked($key)
|
||||
{
|
||||
$cachekey = self::getCacheKey($key);
|
||||
$cachekey = self::getLockKey($key);
|
||||
$lock = $this->cache->get($cachekey);
|
||||
return isset($lock) && ($lock !== false);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ class CacheLockDriver extends AbstractLockDriver
|
|||
* @param string $key The original key
|
||||
* @return string The cache key used for the cache
|
||||
*/
|
||||
private static function getCacheKey($key) {
|
||||
return self::getApp()->get_hostname() . ";lock:" . $key;
|
||||
private static function getLockKey($key) {
|
||||
return "lock:" . $key;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue