1

使用python-memcached==1.48

终端:

memcached -I 10m

Python:

Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import memcache
>>> mc = memcache.Client(['127.0.0.1:11211'], debug=0)
>>> print(mc.set('test', ''.join(['a' for x in xrange(1*1024*1024+1)])))
0
>>> print(mc.set('test', ''.join(['a' for x in xrange(1*1024*1024)])))
True

有人可以复制吗?

4

1 回答 1

1

在接受大于 1MB 的值之前,您必须知道python-memcache最大值大小是多少:

import memcache

mc = memcache.Client(['127.0.0.1:11211'],
    debug = 0,
    server_max_value_length = 1024*1024*10
)
于 2013-04-06T20:15:22.867 回答