lua-resty-memcached set时有自动压缩功能吗

65 views
Skip to first unread message

郭阳3

unread,
Jun 3, 2014, 5:24:35 AM6/3/14
to open...@googlegroups.com

lua-resty-memcached set数据时,数据太大的话有自动压缩功能吗?

smallfish

unread,
Jun 3, 2014, 6:19:35 AM6/3/14
to open...@googlegroups.com
不会自动压缩,可以试试设置flag值。



On Tue, Jun 3, 2014 at 5:24 PM, 郭阳3 <guoy...@letv.com> wrote:

lua-resty-memcached set数据时,数据太大的话有自动压缩功能吗?

--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty...@googlegroups.com
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
归档: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
教程: http://openresty.org/download/agentzh-nginx-tutorials-zhcn.html

郭阳3

unread,
Jun 3, 2014, 6:30:37 AM6/3/14
to open...@googlegroups.com

请问nginx+lua 能不能读取zip编码文件或者gzip,我存到memcach里的数据是zip压缩后的,读取出来必须解压缩 要不乱码

 

发件人: open...@googlegroups.com [mailto:open...@googlegroups.com] 代表 smallfish
发送时间: 201463 18:19
收件人: open...@googlegroups.com
主题: Re: [openresty] lua-resty-memcached set时有自动压缩功能吗

Ken Lam

unread,
Jun 3, 2014, 7:33:50 AM6/3/14
to open...@googlegroups.com
字符串类型数据设置flag后可以互通

于 14-6-3 下午6:19, smallfish 写道:

郭阳3

unread,
Jun 3, 2014, 8:09:50 AM6/3/14
to open...@googlegroups.com

可以详细说下吗

local ok, err = memc:set(key, result,600,"MEMCACHE_COMPRESSED")

这样?

 

发件人: open...@googlegroups.com [mailto:open...@googlegroups.com] 代表 Ken Lam
发送时间: 201463 19:34

收件人: open...@googlegroups.com
主题: Re: [openresty] lua-resty-memcached set时有自动压缩功能吗

 

字符串类型数据设置flag后可以互通

Ken Lam

unread,
Jun 3, 2014, 8:34:39 AM6/3/14
to open...@googlegroups.com
这是我以前试过的:
local ok, err = memc:set(key, val, exptime, 32)
    if not ok then
        return false
    end

Java用的是com.danga.MemCached.MemCachedClient。32就是Java String序列化/反序列化时的flag值。
看你的语句,不知道是否现在lua-resty-memcached set API有所变化。

于 14-6-3 下午8:08, 郭阳3 写道:

可以详细说下吗

local ok, err = memc:set(key, result,600,"MEMCACHE_COMPRESSED")

这样?

 

发 送时间: 201463 19:34

收件人: open...@googlegroups.com
主题: Re: [openresty] lua-resty-memcached set时 有自动压缩功能吗

 

字符串类型数据设置flag后可 以互通

14-6-3 下午6:19, smallfish 写道:

不会自动压缩,可以试试设置flag值。


--

 

On Tue, Jun 3, 2014 at 5:24 PM, 郭阳3 <guoy...@letv.com> wrote:

lua-resty-memcached set数据时,数据太 大的话有自动 压缩功能吗?

--
--
邮 件来自列表“openresty”,专用于技术讨论!
订 阅: 请发空白邮件到 openresty...@googlegroups.com
发 言: 请发邮件到 open...@googlegroups.com
退 订: 请发邮件至 openresty+...@googlegroups.com
归 档: http://groups.google.com/group/openresty
官 网: http://openresty.org/
仓 库: https://github.com/agentzh/ngx_openresty

Yichun Zhang (agentzh)

unread,
Jun 3, 2014, 1:51:33 PM6/3/14
to openresty
Hello!

On Tue, Jun 3, 2014 at 3:29 AM, 郭阳3 wrote:
> 请问nginx+lua 能不能读取zip编码文件或者gzip,我存到memcach里的数据是zip压缩后的,读取出来必须解压缩 要不乱码
>

可以使用现成的 libz 库的 Lua 绑定,或者参考

http://luajit.org/ext_ffi_tutorial.html#zlib

直接通过 LuaJIT FFI 调用 zlib 的 C API.

Regards,
-agentzh
Reply all
Reply to author
Forward
0 new messages