outmatic / MongoDbCache

A distributed cache implementation based on MongoDb
https://outmatic.pl
MIT License
40 stars 15 forks source link

It does not delete expired cache, and don’t take into account configuration #15

Open sirdawidd opened 5 months ago

sirdawidd commented 5 months ago

So it adding records but it doesn’t take into account global cache timeouts only it works when I put configuration object into set method. Global timeouts completely not working. However main issue is that frequently it doesn’t delete old cache just it updates timestamp, and this is completely random.

petrhaus commented 5 months ago

Please provide a minimal example to help reproduce both issues.

The deletion happens in separate fire & forget task, it seems in your case it gets killed for some reasons. However now this can be offloaded to MongoDB by using TTL indexes, and I'm planning to do this change really soon. Apart from not deleting old keys, is it reusing expired ones? Because that should not happen for sure.