• TP5使用redis


     1 <?php
     2 namespace appapicontroller;
     3 use appapicontrollerCommon_base;
     4 use thinkcachedriverRedis;
     5 
     6
     7 class a extends Common_base
     8 {
     9 
    10     public function b(){
    11         extract($_REQUEST);
    12         if (!$a|| !$b) {
    13             die(json_encode(array('result' => 'fail', 'msg' => 'fail')));
    14         }
    15         $key= $a."-".$b;
    16         //redis参数
    17         $options= [
    18             'host'       => '127.0.0.1',
    19             'port'       => 6379,
    20             'password'   => 'xxxxx',
    21             'select'     => 0,
    22             'timeout'    => 0,
    23             'expire'     => 0,
    24             'persistent' => false,
    25             'prefix'     => '',
    26         ];
    27         $redis=new Redis($options);//实例化redis
    28         $handler = $redis->handler();//得到句柄
    29         $handler->hDel('tasks',$key);
    30         $handler->hDel('taskuptime',$key);
    31         $handler->del($key);
    32         die(json_encode(array('result' => 'success', 'msg' => 'success')));
    33 
    34     }
    35 }

     

  • 相关阅读:
    BaseJob
    BaseWorkerForm
    MainForm()
    OperationSystemForm
    Job1
    ExeCuteManager
    ThreadPool
    LogEntry
    java学习阶段一 常量
    java学习阶段一 数据类型
  • 原文地址:https://www.cnblogs.com/CWQPHP/p/10487483.html
Copyright © 2020-2023  润新知