I have written an appliacation using Flask, and am caching the response of various api calls. following is the configuration of my flask app
from flask import Flask
from flask_caching import Cache
app = Flask(__name__)
APICache = Cache(config={'CACHE_TYPE': 'filesystem','CACHE_DIR': "/cache"})
APICache.init_app(app)
How do I list all the key_prefix
of all the cached data that has been stored until now ?
In the background, Flask-Caching uses cachelib, viewing how the cache system is implemented, filesystem doesn't have a dict or a way to access every key, the only way would be to list the directory, and call the
get
method for every file, like this: