Hello!
2012/5/14 wave2050@gmail.com <wave2050@gmail.com>:
> 在使用HttpSRCacheModule过程中,如果对它进行直接通过HTTP的请求
> 访问就可以发挥缓存作用,但是通过ngx.location.capture访问就不会缓存,
> 是我使用错误,还是本身有这个问题?
通过 ngx.location.capture 访问是使用 nginx 子请求。ngx_srcache 是不能对 nginx
子请求的响应进行缓存的,具体细节见官方文档:
http://wiki.nginx.org/HttpSRCacheModule#Subrequest_caching
正如官方文档中的这一节所指出的,子请求的缓存建议直接在 Lua 代码中完成,比如通过 lua-resty-memcached
这样的库,或者通过 ngx.location.capture 访问配置了 ngx_memc 的内部 location.
> 还有就是REDIS+HttpSRCacheModule完全不能使用,请帮忙给个完全的
> 实例看看。谢谢
ngx_srcache 的官方文档中有示例:
http://wiki.nginx.org/HttpSRCacheModule#Caching_with_Redis
当然,真正使用的时候,强烈建议通过 ngx_http_upstream_keepalive 模块配置上 redis 连接池。
如果你遇到问题,请附上相关的详细信息,比如直接问题症状、error.log 调试日志,等等 :) 多谢!
> 我使用的是ngx_openresty-1.0.15.3.tar.gz
嗯,已经是最新版本了,应当包含了所有所需的组件 :)
另外,我强烈建议您订阅 openresty 邮件列表,并在那里和我们交流 ngx_openresty
的相关问题:https://groups.google.com/group/openresty/ 这样我们的讨论可以为更多人看到 ;)
多谢合作 :)
Best regards,
-agentzh