同为分布式缓存,为何Redis更胜一筹?
如今,市面上的缓存解决方案已经逐步成熟了,今天我将选取其中一些代表性的方案包括Redis、Memcached和Tair进行对比,帮助大家在生产实践中更好地进行技术选型。
一、常用的分布式缓存的对比
常用的分布式缓存包括Redis、Memcached和阿里巴巴的Tair(见下表),因为Redis提供的数据结构比较丰富且简单易用,所以Redis的使用广泛。
下面我们从9个大方面来对比最常用的Redis和Memcached。
Linux下安装 Memcached服务器端
#!/bin/sh#Author : shiwei.du
#Date : 2016/04/08
#install libevent
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar zxvf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/
make && make install
cd ..
php memcache类
<?php/*
* 2012-12-04 14:54
* @author 孤独求学人
*/
class php_memcache{
protected $handle = null;
protected $mem = null;
private $host = "";
private $port = "";
private $timeout = 0;
private $pconnect = false;
public function __construct($host = '127.0.0.1',$port='11211',$timeout=0,$pconnect=false){
$this->host = $host;
$this->port = $port;
$this->timeout = $timeout;
$this->pconnect = $pconnect;
$this->mem = new Memcache();
}
热门日志
分类
- Django(4)
- ssdb(1)
- Mac(7)
- C(1)
- memcache(1)
- Python(32)
- Vim(8)
- sed(2)
- ansible(3)
- awk(4)
- shell(3)
- about(1)
- git(9)
- bat(4)
- svn(0)
- docker(1)
- Tornado(1)
- go(2)
- 架构(18)
- Vue(1)
- game(2)
- Html(6)
- Java(8)
- Mysql(37)
- Ajax(2)
- Jsp(1)
- Struts(8)
- Linux(72)
- JavaScript(39)
- Staruml(0)
- Mouth(1)
- Php(102)
- Windows(8)
- Message(48)
- Lua(10)
- Compute(1)
- Redis(7)
- Nginx(12)
- Jquery(1)
- Apache(1)
- cocos2d-x(8)