https://github.com/pkg6/think-redis
An easy way to use the official PHP predis client in your thinkphp applications.
https://github.com/pkg6/think-redis
Last synced: 3 months ago
JSON representation
An easy way to use the official PHP predis client in your thinkphp applications.
- Host: GitHub
- URL: https://github.com/pkg6/think-redis
- Owner: pkg6
- License: mit
- Created: 2023-01-07T12:25:44.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-07T12:34:27.000Z (over 2 years ago)
- Last Synced: 2025-01-09T11:40:59.644Z (5 months ago)
- Language: PHP
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## 安装
```
composer require tp5er/think-redis
```## 基本配置
```
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_PASSWD=
```## 常规使用
> ```
> $redis = new \Predis\Client($parameters = null, $options = null);
> $redis->set('test','test');
> ```您现在可以简单地替换最后两行:
```
$return = \tp5er\think\redis\Redis::set('test','test');
```这将在默认连接上运行命令。 你可以运行一个命令 任何连接(参见 `defaultConnection` 设置和 `connections` 数组 配置文件)。
```
$return = \tp5er\think\redis\Redis::connection('connectionName')->set('test','test');
```## Copyright and License
Copyright (c) 2021 wangzhiqiang