开发者

Why would memcached refuse to store data with some keys?

开发者 https://www.devze.com 2022-12-22 19:47 出处:网络
I use the memcache extension for python, and I have a very strange problem. Memcached refuses to store the exact same data with some keys, and succeeds in caching some others.

I use the memcache extension for python, and I have a very strange problem. Memcached refuses to store the exact same data with some keys, and succeeds in caching some others.

>>> import memcache
>>> conn = memcache.Client('121.0.0.1:11211', debug=0)
>>> conn.set('138b9c95d693760840aab85ee5591d2', 'test');
True
>>> conn.set('138b9c95d693760840aab85ee5591d3', 'test');
0
>>> conn.set('138b9c95d693760840aab85ee5591d4', 'test');
True
>>> conn.set('138b9c95d693760840aab85ee5591d5', 'test');
0
>>> conn.set('138b9c95d693760840aab85ee5591d6', 'test');
True
>>> conn.set('138b9c95d693760840aab85ee5591d7', 'test');
0
>>> conn.set('138b9c95d693760840aab85ee5591d8', 'test');
True
>>> conn.set('138b9c95d693760840aab85ee5591d9', 'test');
True
>>> conn.set('138b9c95d693760840aab85ee5591e0', 'test');
True
>>> conn.set('138b9c95d693760840aab85ee5591e1', 'test');
True

I don't really understand. I should add that I use the version 1.40 of the memcache module with memcached 1.2.8 running on Ubuntu Server 9.10. I restarted the memcached daemon, same result, with the same keys.

Thanks.

Update: I upgraded memcached to version 1.4.2, packaged on lucid repos, with the exact same result.

Update #2: The exact same commands entered on another server with a fresh ubuntu setup gives the same result, same places.

Update #3 As suggested, with a list instead of a string in the Client insantiation :

>>> import memcache
>>> conn = memcache.Client(['121.0.0.1:11211'], debug=0)
>>> conn.set('138b9c95d693760840aab85ee5591d2', 'test');
0
>>> conn.set('138b9c95d693760840aab85ee5591d3', 'test');
0
>>> conn.set('138b9c95d693760840aab85ee5591d4', 'test');
0
>>> conn.set('138b9c95d693760840aab85ee5591d5', 'test');
0
>>> conn.set('138b9c95d693760840aab85ee5591d6', 'test');
0
>>> conn.set('138b9c95d693760840aab85ee5591d7', 'test');
0
>>> 
>>> conn = memcache.Client('121.0.0.1:11211', debug=0)
>>> conn.set('138b9c95d693760840aab85ee5591d2', 'test');
True
>>> conn.set('138b9c95d693760840aab85开发者_开发知识库ee5591d3', 'test');
0


The first param should be a list

conn = memcache.Client(['127.0.0.1:11211'], debug=0)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号