Giter Site home page Giter Site logo

memcacheq's Introduction

===============================================
MemcacheQ - Simple Queue Service over Memcache(基于Memcache协议的简单队列服务)
===============================================

Features(特性)
=========
* damn simple
* 十分简单
* very fast
* 非常快
* multiple queue
* 多队列
* concurrent well
* 并行处理
* memcache protocol compatible
* 兼容memcache协议

Getting Started(开始上手)
===============

Download(下载)
---------
See: <http://code.google.com/p/memcacheq/downloads/list>
参看: <http://code.google.com/p/memcacheq/downloads/list>

Installation(安装方法)
-------------
See: <http://memcachedb.org/memcacheq/INSTALL.html>
参看: <http://memcachedb.org/memcacheq/INSTALL.html>

Please take a look at 'ChangeLog' file in the distribution, see what's new.
请查看发行包中的ChangeLog以确认新增加的特性。

Commands(使用方法)
---------

Only two commands are used to operate the queue:
只需要两种命令就可以操作队列:

**Append a message to the tail of queue**::
**将队列项插入队尾**::

   set <queue name> <flags> 0 <message_len>\r\n
   <put your message body here>\r\n
   STORED\r\n

**Note:** MQ will create a new queue automatically if your queue is not existed. The original 'expire time' field is ignored by server.
**注意:** 如果队列不存在,MQ会自动创建一个。命令中的'expire time'字段默认被服务器忽略。

**Consume a message from the head of queue**::
**从队首取出一个队列项**::

   get <queue name>\r\n
   VALUE <queue name> <flags> <message_len>\r\n
   <your message body will come here>\r\n
   END\r\n

   
Examples(示例)
---------

Assuming you are using PHP memcache<http://www.php.net/memcache>::
假设你使用的是PHP memcache扩展<http://www.php.net/memcache>::

  <?php
  /* connect to memcached server */
  $memcache_obj = memcache_connect('memcacheq_host', 21201);

  /* append a message to queue */
  memcache_set($memcache_obj, 'demoqueue1', 'message body here', 0, 0);
  
  /* consume a message from 'demoqueue1' */
  memcache_get($memcache_obj, 'demoqueue1');

  memcache_close($memcache_obj);
  ?>
  
Limitation(局限性)
===========
The message body is stored in Berkeley DB with fixed length. Any message that is shorter than the declared length will automatically be padded with space character (0x20 in the ASCII character set). 
队列项在Berkeley DB中是用固定长度存储的,任何短于预定长度的队列项都会被用空格填充(对应于ASCII表中的0x20)。

In Berkeley DB, as the official document refers,
在Berkeley DB官方文档中提及到:

"For the Queue access method, the record length must be enough smaller than the database's page size that at least one record plus the database page's metadata information can fit on each database page."
“使用Queue方式存取数据时,每一条记录的长度必须要小于数据库的页大小,以便该条记录和页的元信息能够完整的放在一个页中。”

"The minimum page size is 512 bytes, the maximum page size is 64K bytes, and the page size must be a power-of-two."
“页大小最小值是512字节,最大值是64KB,必须是2的整数次幂。”

So we have a limit on the message body size with a max of a bit less than *64K*.
因此,我们规定队列项的字节数上限是略小于*64K*的某个值。

Other tips(其他细节)
===========
use 'stats queue' to see your current queues::
使用'stats queue'命令观察队列状态::

  $ telnet 127.0.0.1 22201
  Trying 127.0.0.1...
  Connected to localhost.
  Escape character is '^]'.
  stats queue
  STAT test1 12231/12
  STAT test2 23/23
  STAT test3 1212/12
  STAT test4 1/1
  END
  
delete a queue::
删除队列::

  $ telnet 127.0.0.1 22201
  Trying 127.0.0.1...
  Connected to localhost.
  Escape character is '^]'.
  delete test1
  DELETED
  
  
Feedback(反馈)
=========
MemcacheDB mailing list now hosts on Google Group: http://groups.google.com/group/memcachedb
使用MemcacheDB在Google Group上的邮件列表: http://groups.google.com/group/memcachedb

* To subscribe to maillist, send email to [email protected]
* 发送Email至[email protected]订阅邮件列表
* To post to maillist, send email to [email protected]
* 发送Email至[email protected]参与讨论
* To unsubscribe from maillist, send email to [email protected]
* 发送Email至[email protected]取消订阅

Please report your bugs and issues to the Maillist.
请通过邮件列表反馈Bug,提出建议。

Last updated by Steve Chu<http://stvchu.org>: 12/09/2009
由Steve Chu<http://stvchu.org>于2009年12月9日最后一次更新

由Timandes White<[email protected]>于2013年12月4日最后一次翻译

memcacheq's People

Contributors

stvchu avatar timandes avatar

Watchers

 avatar  avatar

memcacheq's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.