diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-01-09 18:31:39 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-01-09 19:49:59 +0100 |
commit | b8b4df5425e25403e77b108333faa2251b1348b3 (patch) | |
tree | 7dc2136658bcaff9b679799ae22c5e6acecc03fc /settings/ajax | |
parent | 59a1d16d0fd3d67833bfb728ce03cebc7fec4043 (diff) | |
download | nextcloud-server-b8b4df5425e25403e77b108333faa2251b1348b3.tar.gz nextcloud-server-b8b4df5425e25403e77b108333faa2251b1348b3.zip |
Cache responses from the AppStore server
Otherwise every time the AppStore was opened a lot of connections to the AppStore server were made which resulted in a terrible performance.
This changeset will cache the response for a sensible time so that only the first request will be somewhat slow.
Performance changes:
- Loading a category took previously more than 3 seconds on my machine. Now for every follow-up request it takes less than 200ms, resulting in a performance gain of 1950%
- Loading the category list took previously about 750ms - now it takes 154ms, a total performance gain of 395%
Diffstat (limited to 'settings/ajax')
-rw-r--r-- | settings/ajax/disableapp.php | 4 | ||||
-rw-r--r-- | settings/ajax/enableapp.php | 3 | ||||
-rw-r--r-- | settings/ajax/installapp.php | 3 | ||||
-rw-r--r-- | settings/ajax/uninstallapp.php | 3 |
4 files changed, 13 insertions, 0 deletions
diff --git a/settings/ajax/disableapp.php b/settings/ajax/disableapp.php index c1e5bc8eac7..1a133ea9af7 100644 --- a/settings/ajax/disableapp.php +++ b/settings/ajax/disableapp.php @@ -10,5 +10,9 @@ if (!array_key_exists('appid', $_POST)) { $appId = $_POST['appid']; $appId = OC_App::cleanAppId($appId); +// FIXME: Clear the cache - move that into some sane helper method +\OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-0'); +\OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-1'); + OC_App::disable($appId); OC_JSON::success(); diff --git a/settings/ajax/enableapp.php b/settings/ajax/enableapp.php index 81ca1e0338d..88abff487db 100644 --- a/settings/ajax/enableapp.php +++ b/settings/ajax/enableapp.php @@ -7,6 +7,9 @@ $groups = isset($_POST['groups']) ? $_POST['groups'] : null; try { OC_App::enable(OC_App::cleanAppId($_POST['appid']), $groups); + // FIXME: Clear the cache - move that into some sane helper method + \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-0'); + \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-1'); OC_JSON::success(); } catch (Exception $e) { OC_Log::write('core', $e->getMessage(), OC_Log::ERROR); diff --git a/settings/ajax/installapp.php b/settings/ajax/installapp.php index 80bc1819724..f25e68214a7 100644 --- a/settings/ajax/installapp.php +++ b/settings/ajax/installapp.php @@ -12,6 +12,9 @@ $appId = OC_App::cleanAppId($appId); $result = OC_App::installApp($appId); if($result !== false) { + // FIXME: Clear the cache - move that into some sane helper method + \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-0'); + \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-1'); OC_JSON::success(array('data' => array('appid' => $appId))); } else { $l = \OC::$server->getL10N('settings'); diff --git a/settings/ajax/uninstallapp.php b/settings/ajax/uninstallapp.php index cae7c33f292..e50fc31a449 100644 --- a/settings/ajax/uninstallapp.php +++ b/settings/ajax/uninstallapp.php @@ -12,6 +12,9 @@ $appId = OC_App::cleanAppId($appId); $result = OC_App::removeApp($appId); if($result !== false) { + // FIXME: Clear the cache - move that into some sane helper method + \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-0'); + \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-1'); OC_JSON::success(array('data' => array('appid' => $appId))); } else { $l = \OC::$server->getL10N('settings'); |