I would like to save a value from a database that will not change during the request / response cycle, but will be used hundreds (potentially thousands) times.
eg:.
#somefile.py def get_current_foo(request):
I am currently using memcached to store the value, but this thing is called enough that even using memcached to store the value is a bottleneck (I profile it when we talk). Is there a way to "cache" a value in memory for the current request / response cycle?
(follow Are python and global (?) variables local threads? )
source share