An open API service indexing awesome lists of open source software.

https://github.com/lingyintech/yii2-predis

yii2-predis
https://github.com/lingyintech/yii2-predis

predis yii2-extension

Last synced: 2 months ago
JSON representation

yii2-predis

Awesome Lists containing this project

README

          

# yii2-predis

在yii2 框架中使用 predis , 支持cluster,sentinel

## 安装

```
composer require lingyin/predis
```

## 配置

```
return [
'components' =>
'cache' => [
'class' => \lingyin\predis\Cache::class,
'keyPrefix' => 'lingyin-common:',
'redis' => [
'parameters' => [
[
'host' => '127.0.0.1',
'port' => 6380,
],
[
'host' => '127.0.0.1',
'port' => 6381,
],
],
'options' => [
'replication' => 'sentinel',
'service' => 'sentinel-127.0.0.1-6380',
'parameters' => [
'password' => 'profileLogStash',
'database' => 4,
]
],
]
]
]
```

## 使用

```
// set
$result = Yii::$app->cache->set('test','test',600);

// get
$value = Yii::$app->cache->get('test');

```