summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2016-05-17 09:03:57 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2016-05-17 09:03:57 +0200
commit5e03e9a843aeccfb66e9f4156afa4bae89065fa3 (patch)
tree5c8ebc6e81fdbe6bddb1b78ea328f1b9a55bffe2 /lib/private
parent86d3dcd7e84919f1e7842f027aeabba05d73b670 (diff)
parentf81b57bc451d50555a2ed198127e6031f66c7031 (diff)
downloadnextcloud-server-5e03e9a843aeccfb66e9f4156afa4bae89065fa3.tar.gz
nextcloud-server-5e03e9a843aeccfb66e9f4156afa4bae89065fa3.zip
Merge pull request #24083 from owncloud/fix-race-condition
Read only once
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Route/CachingRouter.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/private/Route/CachingRouter.php b/lib/private/Route/CachingRouter.php
index d6270dcf2c7..063d389e98b 100644
--- a/lib/private/Route/CachingRouter.php
+++ b/lib/private/Route/CachingRouter.php
@@ -50,8 +50,9 @@ class CachingRouter extends Router {
public function generate($name, $parameters = array(), $absolute = false) {
asort($parameters);
$key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . sha1(json_encode($parameters)) . intval($absolute);
- if ($this->cache->hasKey($key)) {
- return $this->cache->get($key);
+ $cachedKey = $this->cache->get($key);
+ if ($cachedKey) {
+ return $cachedKey;
} else {
$url = parent::generate($name, $parameters, $absolute);
$this->cache->set($key, $url, 3600);