> For the complete documentation index, see [llms.txt](https://sw-fw-less.gitbook.io/project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sw-fw-less.gitbook.io/project/database/redis.md).

# Redis

### Example

```
// Pick a resource from pool manually
$key = $this->redisPool->getKey($originKey);
/** @var \Redis $redis */
$redis = $this->redisPool->pick();
try {
    $redis->set('foo', 'bar');
} catch (\Exception $e) {
    throw $e;
} finally {
    $this->redisPool->release($redis);
}

// Use php stream
unlink('redis://foo'); // del foo
file_put_contents('redis://foo', 'bar'); // set foo bar
file_get_contents('redis://foo') // get foo
```

For detailed usage, please see [document](https://github.com/phpredis/phpredis/).
