Redis.php 475 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: leo
  5. * Date: 2018/2/28
  6. * Time: 上午11:43
  7. */
  8. namespace common\components;
  9. use yii\redis\Connection;
  10. class Redis extends Connection
  11. {
  12. /**
  13. * Redis constructor.
  14. * @param array $config
  15. * @throws \RedisException
  16. */
  17. public function __construct($config = [])
  18. {
  19. parent::__construct($config);
  20. $this->open();
  21. }
  22. public static function key($key){
  23. return md5($key);
  24. }
  25. }