diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2016-10-13 13:13:39 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-10-13 19:40:40 +0200 |
commit | 77272ea52df92a0bc5fcbaacc1d166dc6eb33811 (patch) | |
tree | 9b8aebc8c80c59ac9820dac02b1115e62dbef672 /lib/private/AllConfig.php | |
parent | 8c760e91876a016e16f8e5ec9e18f7a274f96c4d (diff) | |
download | nextcloud-server-77272ea52df92a0bc5fcbaacc1d166dc6eb33811.tar.gz nextcloud-server-77272ea52df92a0bc5fcbaacc1d166dc6eb33811.zip |
Use cache to determine if value need to be updated
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/AllConfig.php')
-rw-r--r-- | lib/private/AllConfig.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php index 52d77bf3f52..af26d30d8e9 100644 --- a/lib/private/AllConfig.php +++ b/lib/private/AllConfig.php @@ -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 = [ |