totherik / nconf-mongodb

A mongodb store for nconf
MIT License
2 stars 2 forks source link

Multiple readers after expire thrash cache #3

Open mfowlewebs opened 9 years ago

mfowlewebs commented 9 years ago

If more than one reader comes in after the cache expires, each reader will kick off it's own retrieval of the new data.

As soon as the first of those reads comes back from Mongo, reads will go back to reading from the cache, which means the window where this could happen should be fairly small- as long as reading the one entry takes- but it's still pretty ugly, and it also thrashes the cache, with each overlapping reader doing their own write into the cache.