The cache held the category names in all 96 app store languages
(about 49 KB), while an instance typically uses one or two. Keep only
English, the default language and the languages users have set, as the
two-letter codes the lookup uses; on a Dutch instance this is about
1.3 KB.
A user who switches to a language that is not cached yet sees English
names until the cache is refreshed after a week, or right away when an
admin saves the settings. The README mentions this.
The app store category cache (cache-categories) held the name and
description of every category in every language, about 170 KB, stored
as a regular app config value. Nextcloud loads all regular values of
all apps on every request, so this one value was read on every page
load. It was only refreshed with the "remove cache" button.
- Keep only the category ids and names, store the cache as a lazy
value so it is only loaded when categories are needed, and refresh
it after a week.
- Only load the categories where they are used: the menus with
categories, and the app list when custom categories are set.
- Save all settings in one request to a new admin endpoint, which
accepts only known settings, then clears the category cache and
changes the stylesheet cache key. The settings page sent one request
per setting and reloaded right after; with Nextcloud's short-lived
local config cache, the reloaded page could show a half-saved
configuration, so a change sometimes had to be made twice.