【发布时间】:2014-05-24 05:37:01
【问题描述】:
我想构建一个缓存代理作为 Python WSGI 中间件,想知道这个中间件如何找出缓存页面是否过期。据我所知,WSGI 不支持 Java Servlets 的 getLastModified(HttpServletRequest req) 方法。
我不寻找的是带有“如果修改后”或“etags”的每个客户端缓存策略。我想为所有客户端(如代理服务器)缓存内容。因此缓存必须检查 WSGI 应用程序或 REST 方面的资源是否被修改并因此在缓存中过期。
client cache wsgi app
------ ----- --------
| get /some/x | |
|------------------>| /some/x expired? |
| |------------------->|
| | |
| | update /some/x |
| | if modified |
| return /some/x |<-------------------|
|<------------------|
不绕过WSGI可以实现吗?
【问题讨论】: