I have a setup like this:
var cacher = require('sequelize-redis-cache');
var redis = require('redis');
var Sequelize = require('sequelize');
var rc = redis.createClient(6379, 'localhost');
var db = new Sequelize('cache_tester', 'root', 'root', { dialect: 'mysql' });
var cacheObj = cacher(db, rc)
.model('sequelize-model-name')
.ttl(5);
const find1 = await cacheObj.find({attributes:['name'], where: { type: 'user', confirmed: true } })
const find2 = await cacheObj.find({attributes:['name'], where: { type: 'admin', confirmed: true } })
When I log the queries,
SELECT 'name' FROM 'sequelize-model-name' WHERE id = 2 is run twice...
At first I thought the use of async/await seemed to cause the issue,
but changing to then didn't change the fact.
I have a setup like this:
When I log the queries,
SELECT 'name' FROM 'sequelize-model-name' WHERE id = 2is run twice...At first I thought the use of
async/awaitseemed to cause the issue,but changing to
thendidn't change the fact.