sebelga / nsql-cache

Advanced cache layer for NoSQL databases
MIT License
9 stars 3 forks source link

fix: custom config undefined on init #8

Closed ablewalmsley closed 4 years ago

ablewalmsley commented 4 years ago

custom settings for certain variables (i.e. hashCacheKeys) are not used, as config ends up undefined before overwriting default options.

workaround for #7

sebelga commented 4 years ago

Hi @ablewalmsley, I am not sure I follow what is the issue. Could you write a small example ? Cheers!

ablewalmsley commented 4 years ago

@sebelga db, and stores get passed in, but hashCacheKeys does not. This is because config end up as undefined on line 69 of your current code. new NsqlCache({ db, hashCacheKeys: false, stores: [ { store: redisStore, host: process.env.REDIS_HOST, auth_pass: process.env.REDIS_PASSWORD } ] })

sebelga commented 4 years ago

The hasCacheKeys needs to be inside the config object. Have you tried this?

new NsqlCache({
  db,
  config: {
    hashCacheKeys: false
  },
  stores: [
    { store: redisStore, host: process.env.REDIS_HOST, auth_pass: process.env.REDIS_PASSWORD }
  ]
})
ablewalmsley commented 4 years ago

whoops, haha, my mistake, thanks for clearing it up!