• redis和memcache


    redis安装:($sudo apt-get update,$sudo apt-get install redis-server)

    redis启动:($redis-server);

    查看redis是否运行:($redis-cli,ping);

    ubuntu上安装redis桌面管理器:可以从 http://redisdesktop.com/download 下载包并安装它。

    window下memcache安装(可用的非官方版本(http://code.jellycan.com/memcached/),下载后运行memcached.exe –d install)

    linux下memcache安装:(安装服务端$sudo apt-get install memcached

    memcache服务启动:(memcached -d -m 128 -p 11211 -u root)

    {

          memcached服务的启动参数:
          -p 监听的端口
          -l 连接的IP地址, 默认是本机
          -d start 启动memcached服务
          -d restart 重起memcached服务
          -d stop|shutdown 关闭正在运行的memcached服务
          -d install 安装memcached服务
          -d uninstall 卸载memcached服务
          -u 以的身份运行 (仅在以root运行的时候有效)
          -m 最大内存使用,单位MB。默认64MB
          -M 内存耗尽时返回错误,而不是删除项
          -c 最大同时连接数,默认是1024
          -f 块大小增长因子,默认是1.25-n 最小分配空间,key+value+flags默认是48
          -h 显示帮助

    }

    安装客户端:$sudo apt-get install php5-memcache,然后在php.ini文件里修改配置,之后重启apache

     1    connect('localhost',11211);
     2    $val='this is a test';
     3    $key=md5($val);
     4    $mem->set($key,$val,0,120);
     5    $k=$mem->get($key);
     6    if($k){
     7         echo 'from cache:'.$k;
     8    }else{
     9         echo 'normal';
    10    }
    php中使用memcache
    1 <?php
    2    $redis=new Redis();
    3    $redis->connect('127.0.0.1',6379);
    4    echo "connected";
    5    $redis->set('tutorial-name','Redis tutorial');
    6    echo $redis->get('tutorial-name');
    7 ?>
    php中使用redis
  • 相关阅读:
    数据库知识点
    hibernate5--主键生成策略
    hibernate5学习知识点小结
    hibernate5小案例讲解
    hibernate5新手跳过的坑
    strut2_struts.xml文件配置知识点汇集
    在使用ElementUI的JSP项目中,集成富文本编辑器QuillEditor
    如何在JSP中使用VUE/elementUI
    Java定时任务--Timer和TimerTask
    SecureFX的破解问题
  • 原文地址:https://www.cnblogs.com/li-mei/p/6373067.html
Copyright © 2020-2023  润新知