|
|
|
|
@ -21,6 +21,7 @@
|
|
|
|
|
|
|
|
|
|
namespace OC\Lock;
|
|
|
|
|
|
|
|
|
|
use OCP\IMemcacheTTL;
|
|
|
|
|
use OCP\Lock\LockedException;
|
|
|
|
|
use OCP\IMemcache;
|
|
|
|
|
|
|
|
|
|
@ -37,6 +38,12 @@ class MemcacheLockingProvider extends AbstractLockingProvider {
|
|
|
|
|
$this->memcache = $memcache;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function setTTL($path) {
|
|
|
|
|
if ($this->memcache instanceof IMemcacheTTL) {
|
|
|
|
|
$this->memcache->setTTL($path, self::TTL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $path
|
|
|
|
|
* @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
|
|
|
|
|
@ -69,6 +76,7 @@ class MemcacheLockingProvider extends AbstractLockingProvider {
|
|
|
|
|
throw new LockedException($path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$this->setTTL($path);
|
|
|
|
|
$this->markAcquire($path, $type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -106,6 +114,7 @@ class MemcacheLockingProvider extends AbstractLockingProvider {
|
|
|
|
|
throw new LockedException($path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$this->setTTL($path);
|
|
|
|
|
$this->markChange($path, $targetType);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|