Deleting a key in Cache after being requested X times

Viewed 21

I am working with a flask application and I am using flask cache to store Bearer tokens for a scraping tool.

I would like to know if there is a way to automatically delete a variable from cache after it being retrieved X amount of times, because those bearer tokens have a maximum number o requests.

Bear in mid that the scraper will be running with multiple parallel requests, so I need to be sure that, for example, on the 50th use the token will be gone and no other parallel process can get it.

It does not matter the type of cache. If you find a way to implement this functionality I will use it :)

0 Answers
Related