0

My web application uses the Pyramid framework, and runs on a Debian Linux system. I'm adding python-memcached to the application but cannot get the objects to be stored and retrieved. I get a null value when I retrieve a object from memcached using the key I used to set it with. The testing/debugging server I am using is the Pyramid Framework pserve server.

import memcache
mc = memcache.Client(['127.0.0.1:6543'], debug=0)
mc.set('key1', 'value1', 10)
val = mc.get('key1')

The val is equal to 'null'.

The command I use to run the application is:

$ pserve development.ini --reload
4

1 回答 1

1

我怀疑您的 memcache 服务器正在端口 6543 上运行 - 假设您使用默认的金字塔配置文件,您的开发服务器在端口 6543 上运行,您的 memcache 服务器可能在端口 11211 上。尝试运行 memcache 服务器然后设置

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

于 2013-01-10T06:18:31.017 回答