Skip to content

Commit

Permalink
fix(platform-cache): add $ctx to key resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed May 13, 2024
1 parent 098f279 commit c47d18e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class PlatformCacheInterceptor implements InterceptorMethods {
}

async cacheMethod(context: InterceptorContext<any, PlatformCacheOptions>, next: InterceptorNext) {
const {key, type, ttl, collectionType, refreshThreshold, keyArgs, args, canCache} = this.getOptions(context);
const {key, type, ttl, collectionType, refreshThreshold, args, canCache} = this.getOptions(context);

const set = (result: any) => {
if (!canCache || (canCache && canCache(result))) {
Expand Down Expand Up @@ -176,7 +176,7 @@ export class PlatformCacheInterceptor implements InterceptorMethods {
let {canCache} = context.options || {};

const args = this.getArgs(context);
const keyArgs = isString(k) ? k : k(args);
const keyArgs = isString(k) ? k : k(args, $ctx);

if (canCache && canCache === "no-nullish") {
canCache = (item: any) => ![null, undefined].includes(item);
Expand Down

0 comments on commit c47d18e

Please sign in to comment.