rfink / sequelize-redis-cache

Small fluent interface for caching sequelize database query results in redis more easily
MIT License
174 stars 47 forks source link

Fixed the issue #31 #34

Closed shaozujie closed 7 years ago

shaozujie commented 7 years ago

This library is very useful! Now it works !

rfink commented 7 years ago

Thanks! Were you able to reliably reproduce?

shaozujie commented 7 years ago

@rfink Thanks for the reply! Yes, this can be a steady reproduction. This is because the cache key name uses the public variable of the top-level namespace. When multiple queries are made at the same time, the database asynchronous query causes the key name to be updated and the same value is assigned to the different keys when the result is returned. If we use the function parameter to pass the key name, we can prevent this from happening. After many verification, the fact is true, and we are using the revised version, stable operation!

rfink commented 7 years ago

Wow that makes sense. Thanks a ton for finding that, I was pulling my hair out trying to reproduce and find the issue. I hope the module is working out well for you.