MOBILE-4086 core: Add missing cacheKey to some WS calls

main
Dani Palou 2022-05-31 12:55:43 +02:00
parent a878c65b29
commit dd3f73b819
2 changed files with 23 additions and 1 deletions

View File

@ -1404,6 +1404,7 @@ export class CoreSite {
getFromCache: true, getFromCache: true,
saveToCache: true, saveToCache: true,
emergencyCache: true, emergencyCache: true,
cacheKey: this.getPublicConfigCacheKey(),
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), ...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
}; };
@ -1466,6 +1467,15 @@ export class CoreSite {
} }
} }
/**
* Get cache key for getPublicConfig WS calls.
*
* @return Cache key.
*/
protected getPublicConfigCacheKey(): string {
return 'tool_mobile_get_public_config';
}
/** /**
* Perform a request to the server to get the public config of this site. * Perform a request to the server to get the public config of this site.
* *

View File

@ -302,13 +302,25 @@ export class CoreSitePluginsProvider {
const data = await site.read<CoreSitePluginsGetPluginsSupportingMobileWSResponse>( const data = await site.read<CoreSitePluginsGetPluginsSupportingMobileWSResponse>(
'tool_mobile_get_plugins_supporting_mobile', 'tool_mobile_get_plugins_supporting_mobile',
{}, {},
{ getFromCache: false }, {
getFromCache: false,
cacheKey: this.getPluginsCacheKey(),
},
); );
// Return enabled plugins. // Return enabled plugins.
return data.plugins.filter((plugin) => this.isSitePluginEnabled(plugin, site)); return data.plugins.filter((plugin) => this.isSitePluginEnabled(plugin, site));
} }
/**
* Get cache key for get plugins WS call.
*
* @return Cache key.
*/
protected getPluginsCacheKey(): string {
return ROOT_CACHE_KEY + 'plugins';
}
/** /**
* Get a site plugin handler. * Get a site plugin handler.
* *