redis終端簡單命令

2022-08-23 03:42:11 字數 1700 閱讀 1942

keys * 獲取所有鍵

lrange hongbao:44 0 -1獲取該鍵的所有值

del hongbao:44 刪除該鍵的所有值

hgetall user:44 獲取該鍵的所有佇列

hget hongbao:44 8 獲取該佇列使用者為8的值

hset hongbao:44 7 'asdf'設定該佇列使用者為7的值

hdel user:44 8 刪除該佇列使用者為8的值

flushall 清空redis所有快取資料

<?php

/** to change this license header, choose license headers in project properties.

* to change this template file, choose tools | templates

* and open the template in the editor.

*/namespace home\controller;

use think\controller;

use home\util\apiresponse;

/*** description of rediscontroller

** @author administrator

*/class sweepcontroller extends basecontroller

if (empty($options))

$this->options = $options;

$this->options['expire'] = isset($options['expire']) ? $options['expire'] : c('data_cache_time');

$this->options['prefix'] = isset($options['prefix']) ? $options['prefix'] : c('data_cache_prefix');

$this->options['length'] = isset($options['length']) ? $options['length'] : 0;

$this->options['dbindex'] = isset($options['dbindex']) ? $options['dbindex'] : 0;

$func = $options['persistent'] ? 'pconnect' : 'connect';

$this->handler = new \redis;

$options['timeout'] === false ?

$this->handler->$func($options['host'], $options['port']) :

$this->handler->$func($options['host'], $options['port'], $options['timeout']);

$this->handler->select($this->options['dbindex']);

}$data = array();

if ($min * $num > $total)

if($max*$num < $total)

while ($num >= 1)

return $data;}/*

* redis除錯

*/public function order_num()

Redis簡單命令

啟動服務 redis server redis.conf 1 2 1 連線redis redis cli h 127.0.0.1 p 6379 獲取所有的key keys 判斷乙個鍵是否存在 exists key 刪除鍵del key key.賦值 set key value取值 get key r...

Mac 終端 Linux 命令總結 簡單命令

命令名 功能描述 使用舉例 mkdir 建立乙個目錄 mkdir dirname rmdir 刪除乙個目錄 rmdir dirname mvdir 移動或重新命名乙個目錄 mvdir dir1 dir2 cd改變當前目錄 cd dirname pwd顯示當前目錄的路徑名 pwdls 顯示當前目錄的內...

Mac 終端 Linux 命令總結 簡單命令

命令名 功能描述 使用舉例 mkdir 建立乙個目錄 mkdir dirname rmdir 刪除乙個目錄 rmdir dirname mvdir 移動或重新命名乙個目錄 mvdir dir1 dir2 cd改變當前目錄 cd dirname pwd顯示當前目錄的路徑名 pwdls 顯示當前目錄的內...