Hello!
2015-07-02 19:21 GMT+08:00 wonderbeyond:
> Aliyun KVStore 说是兼容redis,
只要真的兼容 Redis 2 协议,就不会有问题。
> 所以配合ngx_http_redis做页面缓存, 但是KVStore必须要凭密码认证,
> 这个如何搞呢?
>
应该是使用的 Redis 的 auth 命令:
http://redis.io/commands/AUTH
于是对应地,对于 resty.redis 对象,直接调用 auth 方法就好了,比如
local ok, err = red:auth("my-password")
如果你使用连接池的话,只需对于新创建的 redis 连接调用 auth(). 判断是否为新连接的方法是检查
get_reused_times() 调用的返回值,如果为 0,则表明是新创建的连接,而不是从连接池复用的连接。见
https://github.com/openresty/lua-resty-redis#get_reused_times
Regards,
-agentzh