mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
Use cache to determine if value need to be updated
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
8c760e9187
commit
77272ea52d
1 changed files with 19 additions and 0 deletions
|
|
@ -215,6 +215,25 @@ class AllConfig implements \OCP\IConfig {
|
|||
// TODO - FIXME
|
||||
$this->fixDIInit();
|
||||
|
||||
if (isset($this->userCache[$userId][$appName][$key])) {
|
||||
if ($this->userCache[$userId][$appName][$key] === (string)$value) {
|
||||
return;
|
||||
} else if ($preCondition !== null && $this->userCache[$userId][$appName][$key] !== (string)$preCondition) {
|
||||
return;
|
||||
} else {
|
||||
$qb = $this->connection->getQueryBuilder();
|
||||
$qb->update('preferences')
|
||||
->set('configvalue', $qb->createNamedParameter($value))
|
||||
->where($qb->expr()->eq('userid', $qb->createNamedParameter($userId)))
|
||||
->andWhere($qb->expr()->eq('appid', $qb->createNamedParameter($appName)))
|
||||
->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter($key)));
|
||||
$qb->execute();
|
||||
|
||||
$this->userCache[$userId][$appName][$key] = $value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$preconditionArray = [];
|
||||
if (isset($preCondition)) {
|
||||
$preconditionArray = [
|
||||
|
|
|
|||
Loading…
Reference in a new issue