@reactionary/core 0.9.16 → 0.9.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -16,10 +16,10 @@ class BaseCapability {
|
|
|
16
16
|
const hash = h.hash(identifier);
|
|
17
17
|
return [hash];
|
|
18
18
|
}
|
|
19
|
-
generateCacheKeyForQuery(scope, query) {
|
|
19
|
+
generateCacheKeyForQuery(scope, query, locale, currency) {
|
|
20
20
|
const h = hasher({ sort: true, coerce: false });
|
|
21
21
|
const queryHash = h.hash(query);
|
|
22
|
-
return `${scope}:${queryHash}`;
|
|
22
|
+
return `${scope}:${queryHash}:${locale}:${currency}`;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
export {
|
|
@@ -63,7 +63,9 @@ function Reactionary(options) {
|
|
|
63
63
|
if (!input.success) {
|
|
64
64
|
return input;
|
|
65
65
|
}
|
|
66
|
-
const
|
|
66
|
+
const localeCacheKey = options.localeDependentCaching ? this.context.languageContext?.locale ?? "all" : "all";
|
|
67
|
+
const currencyCacheKey = options.currencyDependentCaching ? this.context.languageContext?.currencyCode ?? "all" : "all";
|
|
68
|
+
const cacheKey = this.generateCacheKeyForQuery(scope, input.value, localeCacheKey, currencyCacheKey);
|
|
67
69
|
let fromCache = null;
|
|
68
70
|
if (options.cache) {
|
|
69
71
|
fromCache = await this.cache.get(
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ export declare abstract class BaseCapability {
|
|
|
9
9
|
protected context: RequestContext;
|
|
10
10
|
constructor(cache: Cache, context: RequestContext);
|
|
11
11
|
generateDependencyIdsForModel(model: unknown): Array<string>;
|
|
12
|
-
protected generateCacheKeyForQuery(scope: string, query: object): string;
|
|
12
|
+
protected generateCacheKeyForQuery(scope: string, query: object, locale: string, currency: string): string;
|
|
13
13
|
/**
|
|
14
14
|
* Returns the abstract resource name provided by the remote system.
|
|
15
15
|
*/
|