-
Notifications
You must be signed in to change notification settings - Fork 46
Same cache used for query with different where #31
Copy link
Copy link
Open
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels