Memcached使用与实践

来源:互联网 发布:apache 流媒体点播 编辑:程序博客网 时间:2024/05/02 12:15
  1. ubuntu下:sudo apt-get update,sudo apt-get install mysql-server php5-mysql php5 memcached php5-memcached php5-memcache
  2. 或者centos:yum update yum install memcached 开启服务:systemctl restart memcached,systemctl enable memcached,查看服务状态:systemctl status memcached
  3. 简单使用:
    $mem = new Memcache();
    $mem->connect('localhost',11211); //default port is 11211
    $mem->set('key','value',$timeout);
    $mem->get('key');
0 0