Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我要cache a query result on per request依据。因为我需要在多个地方进行该查询。我想打开cache它并随时随地使用它。并且在周期结束时它应该过期。在这里我找到了一个解决方案,但有一个讨论表明这很危险queryrequestrequest-response
cache a query result on per request
cache
query
request
request-response
有人可以告诉我如何实现这一目标。
您可以修改此处提出的解决方案以使用每个请求的 locmemcache 实例,而不是每个线程的全局缓存。
然后,您可以使用中间件的 process_response 函数来清理本地缓存。