wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar xzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure
make
make install
wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz
tar vxzf memcached-1.4.15.tar.gz
cd memcached-1.4.15
./configure --prefix=/usr/local/webserver/memcached
make
make install
== Install and Run
Install tornado and (optional) python-memcached for client testing
Get the source from
git@github.com:superisaac/redqueue.git Install
% python setup.py install
Make the log dir
% mkdir -p log
Run the server
% redqueue_server.py For more options please run
% redqueue_server.py --help
== Reserve/delete mode
Reserve/delete mode is currently the sole mode, once an item is fetched, a delete request must be send later to mark the item is used, or else the item will be recycled back later.
>>> mc.set('abc', '123')
>>> v = mc.get('abc')
>>> if v is not None:
>>> mc.delete('abc')
现在队列有了,我给大家说下,我那边是咋实现排队的~ 当用户访问页面下一步的时候,我会判断队列,要是他前面有人在进行,我会给他重定向到最初的页面。当别人搞完了,他才可以的。但是这样的话,还有个问题,那就是要是有5个人同时进了队列里面了,我给他们已经排序了,要是老大和老二,他不在进行了,老三的话,咋办。。。 这时候就需要配置队列里面的值和kv的一个值做时间的生效。 也就是说 老大和老二要是在指定的时间内没有完成的话,我会把他们踢出去,这样老三就成老大了。