prisma-redis-middleware icon indicating copy to clipboard operation
prisma-redis-middleware copied to clipboard

General cacheTime is in seconds instead of milliseconds

Open jovanblazek opened this issue 3 years ago • 0 comments

Describe the bug When using this config the cacheTime refers to seconds, not milliseconds as described in README.

const CacheMiddleware = createPrismaRedisCache({
  cacheTime: 10,
  onHit: (key) => {
    console.log('hit', key)
  },
  onMiss: (key) => {
    console.log('miss', key)
  },
  onError: (key) => {
    console.log('error', key)
  },
})

To Reproduce Steps to reproduce the behavior:

  1. Setup middleware with config from above
  2. Run query
  3. Wait 2 seconds and run query again
  4. onHit is triggered

Expected behavior onMiss should be triggered

Desktop (please complete the following information):

  • OS: MacOS 12.4
  • Node: 16.12.0
  • Version 4.0.8

jovanblazek avatar Aug 14 '22 11:08 jovanblazek