Questions tagged [flask-cache]
75 questions
2
votes
1 answer
Flask / Jinja memoization
I have been trying to use and Flask-Cache's memoize feature to only return cached results of statusTS(), unless a certain condition is met in another request where the cache is then deleted.
It is not being deleted though, and the Jinja template…

Ryan
- 21
- 3
2
votes
1 answer
Getting or deleting cache entries in Flask with the key starting with (or containing) a substring
I'm trying to delete all entries in the cache store that contain (in this case start with) a substring of the cache key, but I don't see any easy way of doing this. I'm using Memcache as backend.
If I understand the code correctly, I need to pass…

AJJ
- 7,365
- 7
- 31
- 34
1
vote
0 answers
Delete all related to variable in function using delete_memoized of Flask-Caching
I have some functions like the one below:
@cache.memoize(timeout=18000)
def getAllHave(user_id, i,
currency = "USD")
Parameters currency and i can have a huge amount of values.
I would like to delete all cache from function getAllHave…

Dinidiniz
- 771
- 9
- 15
1
vote
1 answer
Memoization Python Dash: TypeError: expected str, bytes or os.PathLike object, not Flask
I am developping a website with Python Dash and I am trying to implement caching, to speed up the performance of the website. I want to use memoization for this purpose, as suggested on the Dash website: https://dash.plotly.com/performance. On the…

willemlzn
- 13
- 1
- 4
1
vote
1 answer
How to use flask-caching in my structure of project
My code structure. I tried but kept getting error cannot import name 'caching'. I guess my method isn't correct as caching will not have app initiation when I import caching in external file.
xyz
-app.py
-run.py
-urls
-v2.py
-resource
…

Jay Prakash
- 149
- 10
1
vote
0 answers
How to get a specific key which stored in redis by flask-caching
In my flask app, I used flask-caching to cache the query result as below:
@cache.memoize()
def load_user(user_id):
return User.query.get(user_id)
But when I access my redis, the key is like flask_cache_L4kZRWHNrZYUZ8uyY7Mh0i.
It's seem very…

Sơn Nguyễn
- 11
- 2
1
vote
0 answers
Cache flask app functions Based on string of url request
I am trying to cache 2 functions in flask app which I successfully did, using cachetools. The
format of URL request to API is something like:
URL- '***.com/rec/some_id/0/23413444;2134134124;4352352345'
But this logic have some limitations…

MK-MSA
- 11
- 1
1
vote
0 answers
Debugging Web Authentication for Apache Airflow
I am trying to enable web authentication for my gcp vm running an airflow server. I used the official docs to update the config file:
[webserver]
authenticate = True
auth_backend = airflow.contrib.auth.backends.password_auth
as well as create an…

d_-
- 1,391
- 2
- 19
- 37
1
vote
1 answer
Parse bytes stored using Flask-Caching
I used Flask-Caching to cache the response of a Flask view in Redis. Getting the cached data directly from Redis returns some bytes. How can I parse this in Python to examine the cached…

lifeguru42
- 156
- 1
- 12
1
vote
0 answers
How to properly cache the result of an REST API which returns large number of objects
I have an api call which according to some passed values such as budget and time , returns a list of projects. There will be 100s of projects with there data passed as a json list of objects. I want to cache this result so that I dont have to…

DragneelFPS
- 453
- 4
- 12
1
vote
1 answer
Clearing Python Flask cache does not work
I have the following three files.
app.py
from flask_restful import Api
from lib import globals
from flask import Flask
from flask.ext.cache import Cache
globals.algos_app = Flask(__name__)
#cache in file system
globals.cache =…

kosta
- 4,302
- 10
- 50
- 104
1
vote
1 answer
Testing the cache hits for Flask-Cache
I am using cache.memoize to memoize a function with Flask-Cache. How can I get the cache key which got set in the decorated function? How can I test that the function is cached during testing?
from flask import Flask
from flask.ext.cache import…

user1841199
- 33
- 1
- 3
1
vote
1 answer
Using Flask-cache with memcached (AWS Elastic cache)
I have setup memcache using the AWS Elastic cache service. I have verified that I can telnet to the endpoint and store and retrieve items.
Now, I am trying to use memcache for Flask-cache. I have the following code.
from this import s, d
from string…

kosta
- 4,302
- 10
- 50
- 104
1
vote
1 answer
Is Flask-Cache's filesystem cache secure?
I want to cache the results of an authentication function using the cache.memoize decorator.
However the authentication function takes a username and password as arguments, and I need to maintain security.
Cache(config={'CACHE_TYPE':…

steve
- 2,488
- 5
- 26
- 39
1
vote
0 answers
Flask: Unauthenticated user seeing cached app, not being redirected to login page
I have a flask app which serves an Angular JS app only to authenticated users.
Access control for the view which serves the app is implemented with @login_required from the Flask-Login package as follows:
# The app page is accessible only to…

David Simic
- 2,061
- 2
- 19
- 33