2015-04-29 11:19:02 -04:00
|
|
|
<?php
|
|
|
|
|
/**
|
2024-05-10 09:09:14 -04:00
|
|
|
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2015-04-29 11:19:02 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace Test\Lock;
|
|
|
|
|
|
|
|
|
|
use OC\Memcache\ArrayCache;
|
2023-03-29 12:03:03 -04:00
|
|
|
use OCP\AppFramework\Utility\ITimeFactory;
|
2015-04-29 11:19:02 -04:00
|
|
|
|
2016-05-20 09:38:20 -04:00
|
|
|
class MemcacheLockingProviderTest extends LockingProvider {
|
2015-04-29 11:19:02 -04:00
|
|
|
/**
|
|
|
|
|
* @var \OCP\IMemcache
|
|
|
|
|
*/
|
|
|
|
|
private $memcache;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return \OCP\Lock\ILockingProvider
|
|
|
|
|
*/
|
|
|
|
|
protected function getInstance() {
|
|
|
|
|
$this->memcache = new ArrayCache();
|
2023-03-29 12:03:03 -04:00
|
|
|
$timeProvider = \OC::$server->get(ITimeFactory::class);
|
|
|
|
|
return new \OC\Lock\MemcacheLockingProvider($this->memcache, $timeProvider);
|
2015-04-29 11:19:02 -04:00
|
|
|
}
|
|
|
|
|
|
2019-11-27 09:27:18 -05:00
|
|
|
protected function tearDown(): void {
|
2015-04-29 11:19:02 -04:00
|
|
|
$this->memcache->clear();
|
|
|
|
|
parent::tearDown();
|
|
|
|
|
}
|
|
|
|
|
}
|