MOBILE-3594 core: Move ROOT_CACHE_KEY out of the class

main
Pau Ferrer Ocaña 2020-11-19 11:41:49 +01:00
parent b96b6a98fe
commit b27e9eb718
2 changed files with 9 additions and 8 deletions

View File

@ -20,6 +20,8 @@ import { CoreWSExternalWarning } from '@services/ws';
import { CoreSite } from '@classes/site';
import { makeSingleton } from '@singletons/core.singletons';
const ROOT_CACHE_KEY = 'mmaFiles:';
/**
* Service to handle my files and site files.
*/
@ -32,8 +34,6 @@ export class AddonPrivateFilesProvider {
static readonly PRIVATE_FILES_COMPONENT = 'mmaFilesMy';
static readonly SITE_FILES_COMPONENT = 'mmaFilesSite';
protected readonly ROOT_CACHE_KEY = 'mmaFiles:';
/**
* Check if core_user_get_private_files_info WS call is available.
*
@ -125,7 +125,7 @@ export class AddonPrivateFilesProvider {
protected getFilesListCacheKey(params: AddonPrivateFilesGetFilesWSParams): string {
const root = !params.component ? 'site' : 'my';
return this.ROOT_CACHE_KEY + 'list:' + root + ':' + params.contextid + ':' + params.filepath;
return ROOT_CACHE_KEY + 'list:' + root + ':' + params.contextid + ':' + params.filepath;
}
/**
@ -194,7 +194,7 @@ export class AddonPrivateFilesProvider {
* @return Cache key.
*/
protected getPrivateFilesInfoCommonCacheKey(): string {
return this.ROOT_CACHE_KEY + 'privateInfo';
return ROOT_CACHE_KEY + 'privateInfo';
}
/**

View File

@ -21,6 +21,8 @@ import { makeSingleton, Translate } from '@singletons/core.singletons';
import { CoreWSExternalWarning } from '@services/ws';
import { CoreCourseBase } from '@/types/global';
const ROOT_CACHE_KEY = 'mmGroups:';
/*
* Service to handle groups.
*/
@ -31,7 +33,6 @@ export class CoreGroupsProvider {
static readonly NOGROUPS = 0;
static readonly SEPARATEGROUPS = 1;
static readonly VISIBLEGROUPS = 2;
protected readonly ROOT_CACHE_KEY = 'mmGroups:';
/**
* Check if group mode of an activity is enabled.
@ -102,7 +103,7 @@ export class CoreGroupsProvider {
* @return Cache key.
*/
protected getActivityAllowedGroupsCacheKey(cmId: number, userId: number): string {
return this.ROOT_CACHE_KEY + 'allowedgroups:' + cmId + ':' + userId;
return ROOT_CACHE_KEY + 'allowedgroups:' + cmId + ':' + userId;
}
/**
@ -225,7 +226,7 @@ export class CoreGroupsProvider {
* @return Cache key.
*/
protected getActivityGroupModeCacheKey(cmId: number): string {
return this.ROOT_CACHE_KEY + 'groupmode:' + cmId;
return ROOT_CACHE_KEY + 'groupmode:' + cmId;
}
/**
@ -299,7 +300,7 @@ export class CoreGroupsProvider {
* @return Prefix Cache key.
*/
protected getUserGroupsInCoursePrefixCacheKey(): string {
return this.ROOT_CACHE_KEY + 'courseGroups:';
return ROOT_CACHE_KEY + 'courseGroups:';
}
/**