禁用缓存拦截器

时间:2020-05-11 07:04:25

标签: caching nestjs

除了在缓存中放置最小TTL之外,是否有可能在开发过程中禁用缓存拦截器?

import pickle

def calculations(a, b):
    c = a + b
    print('Addition is ', c)
    return c

fun_def_str = pickle.dumps(calculations)

cal = pickle.loads(fun_def_str)

result = cal(5,6) # Prints - Addition is 11

print(result) # Outputs: 11

作为全局变量,因此开发人员不必等到在开发过程中清除缓存。

1 个答案:

答案 0 :(得分:1)

您可以尝试以下方法:

@UseInterceptors(process.env.NODE_ENV === "development" ? function() {} : CacheInterceptor)

基本上,在开发过程中使用虚拟拦截器,以免数据被缓存