```
### 其它
这个插件的src/Redis.php文件里每一个方法都有方法注释,以及使用的example,大大方便了我们使用。更多细节和注意事项,大家可以通过作者的[github](https://github.com/ukko/phpredis-phpdoc)进行查看
```php
/**
* Set the string value in argument as value of the key.
*
* @since If you're using Redis >= 2.6.12, you can pass extended options as explained in example
*
* @param string $key
* @param string|mixed $value string if not used serializer
* @param int|array $timeout [optional] Calling setex() is preferred if you want a timeout.
* Since 2.6.12 it also supports different flags inside an array. Example ['NX', 'EX' => 60]
* - EX seconds -- Set the specified expire time, in seconds.
* - PX milliseconds -- Set the specified expire time, in milliseconds.
* - PX milliseconds -- Set the specified expire time, in milliseconds.
* - NX -- Only set the key if it does not already exist.
* - XX -- Only set the key if it already exist.
*
* // Simple key -> value set
* $redis->set('key', 'value');
*
* // Will redirect, and actually make an SETEX call
* $redis->set('key','value', 10);
*
* // Will set the key, if it doesn't exist, with a ttl of 10 seconds
* $redis->set('key', 'value', ['nx', 'ex' => 10]);
*
* // Will set a key, if it does exist, with a ttl of 1000 milliseconds
* $redis->set('key', 'value', ['xx', 'px' => 1000]);
*
*
* @return bool TRUE if the command is successful
*
* @link https://redis.io/commands/set
*/
public function set($key, $value, $timeout = null)
{
}
```