为redis加了个memcached端口支持mc协议

目前 redis 并不支持 memcache 协议,但已经有人给 redis 2.0 版本 打了个patch,支持 memcache 协议

项目:https://github.com/vislee/medis

如有任何建议和问题,请 New issues https://github.com/vislee/medis/issues

先看下性能测试:

memcachevsmedisredisvsmedis

目前只支持一些 memcache 命令

  1. set
  2. add
  3. replace
  4. append
  5. prepend
  6. get
  7. gets
  8. delete
  9. incr
  10. decr

安装 medis

  1. git clone https://github.com/vislee/medis.git
  2. make
  3. make install

配置文件

  1. # cat /etc/medis.conf
  2. daemonize yes
  3. pidfile /var/run/medis.pid
  4. port 6379
  5. memcached-port 11211
  6.  
  7.  
  8.  
  9. timeout 300
  10. loglevel notice
  11. logfile /var/log/medis.log
  12. databases 3
  13.  
  14. save 900 1
  15. save 300 10
  16. save 60 10000
  17.  
  18.  
  19. rdbcompression yes
  20. dbfilename dump.rdb
  21. dir /var
  22.  
  23.  
  24. maxclients 102400
  25.  
  26. maxmemory 1024mb
  27.  
  28.  
  29. appendonly no
  30. appendfilename appendonly.aof
  31. appendfsync no
  32.  
  33. activerehashing yes

启动

  1. /usr/local/sbin/medis-server /etc/medis.conf

memcache 测试

  1. # telnet 127.0.0.1 11211
  2. Trying 127.0.0.1…
  3. Connected to 127.0.0.1.
  4. Escape character is '^]'.
  5. set aikaiyuan 123 1000 3
  6. aky
  7. STORED
  8. get aikaiyuan
  9. VALUE aikaiyuan 123 3
  10. aky
  11. END

redis 测试

  1. # redis-cli -h 127.0.0.01 -p 6379
  2. redis 127.0.0.01:6379> PING
  3. PONG
  4. redis 127.0.0.01:6379> get aikaiyuan
  5. "aky"
  6. redis 127.0.0.01:6379> SAVE
  7. OK
  8. redis 127.0.0.01:6379>

感谢参与 https://github.com/vislee/medis

如果引用本站的原创文章,请注明原文链接:,本站保留追究责任的权利!