node-cache-manager-ioredis icon indicating copy to clipboard operation
node-cache-manager-ioredis copied to clipboard

Caching ignores serialization options

Open sluchznak opened this issue 4 years ago • 0 comments

Hello. I found that your implementation of cache manager ignores serialization options.

// app initialization
// ....
app.useGlobalInterceptors(new ClassSerializerInterceptor(app.get(Reflector)));
// ...

// DTO
class DtoClass {
  @Expose()
  id: string;

  @Expose({ groups: ["public"] })
  price: number;
}


// Controller
@CacheTTL(10000)
@SerializeOptions({ groups: ["public"], excludeExtraneousValues: true })
@Get("list")
handler(): DtoClass {
  return new DtoClass({ id: "123", price: 123, extraneousValue: "123" });
}

As a result extraneousValue will be in cached response. Default in-memory cache manager works correctly.

sluchznak avatar Aug 04 '21 08:08 sluchznak