lapis icon indicating copy to clipboard operation
lapis copied to clipboard

cache.delete_path() seems to only work for short periods

Open itscorey opened this issue 6 years ago • 1 comments

Any time I restart the lapis server, cache.delete_path works for a good 30 minutes at most. But after that, it just seems to stop working.

Basically, I'm caching a JSON endpoint that I use to grab some data about a game. Anytime a major update happens on the page, I try and delete the cache for that specific page.

cache.delete_path("/game_data/"..self.params.game_id.."/overall")

I think the weirdest part is that it works for a while then eventually just seems to not delete the cache anymore until i restart the server again

itscorey avatar Oct 12 '17 19:10 itscorey

The cache module is a thin layer over openresty's shared dictionary. If you want to try debugging it you can take a look in here: https://github.com/leafo/lapis/blob/master/lapis/nginx/cache.moon

If you see cache entries disappearing then that would suggest that they're getting evicted for some reason. Are you sure your cache isn't filling up?

If you want to try an alternative backend, you can use redis as the cache store: https://github.com/leafo/lapis-redis#redis-cache

leafo avatar Oct 19 '17 00:10 leafo