stanley-king 4 years atrás
parent
commit
228203e29f

+ 0 - 26
application/index/controller/daemon.php

@@ -1,26 +0,0 @@
-<?php
-
-class Daemon{
-
-    protected $handler = null;
-
-    public function init(){
-        $this->handler = new \Redis();
-        $this->handler->connect('39.97.239.116', 6379);
-        $this->handler->auth('huaxiashangmeng');
-        $this->handler->select(1);
-    }
-
-    public function btoc($listname){
-        $result = $this->handler->BRPOP($listname,0);
-        if($result){
-
-        }
-    }
-}
-
-$daemon = new Daemon();
-$daemon->init();
-while (true){
-
-}

+ 1 - 1
conf/php-fpm/php.ini

@@ -1324,7 +1324,7 @@ bcmath.scale = 0
 ; Handler used to store/retrieve data.
 ; http://php.net/session.save-handler
 session.save_handler = redis
-session.save_path = "tcp://redisrv:6379"
+session.save_path = "tcp://devredis:6380"
 
 ;session.save_handler = files
 

+ 1 - 1
conf/redis/6380.conf

@@ -40,7 +40,7 @@
 
 # By default Redis does not run as a daemon. Use 'yes' if you need it.
 # Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
-daemonize yes
+daemonize no
 
 # When running daemonized, Redis writes a pid file in /var/run/redis.pid by
 # default. You can specify a custom pid file location here.

+ 2 - 2
config/cache.php

@@ -15,9 +15,9 @@
 
 return [
     // 驱动方式
-    'type'   => 'File',
+    'type'   => 'redis',
     // 缓存保存目录
-    'path'   => '',
+    'path'   => 'tcp://devredis:6380',
     // 缓存前缀
     'prefix' => '',
     // 缓存有效期 0表示永久缓存

+ 1 - 1
config/session.php

@@ -20,7 +20,7 @@ return [
     // SESSION 前缀
     'prefix'         => 'think',
     // 驱动方式 支持redis memcache memcached
-    'type'           => '',
+    'type'           => 'redis',
     // 是否自动开启 SESSION
     'auto_start'     => true,
 ];

+ 2 - 2
docker-compose-dev.yml

@@ -16,10 +16,10 @@ services:
 
   devredis:
     image: redis:alpine
+    ports:
+      - "6380:6379"
     volumes:
       - $PWD/conf/etc/localtime:/etc/localtime:ro
-      - $PWD/conf/redis/6379.conf:/usr/local/etc/redis/redis.conf
-      - $PWD/conf/redis:/var/redis
     container_name: "dev-redis"
     command: [ "redis-server"]
 

+ 1 - 1
thinkphp/library/think/cache/driver/Redis.php

@@ -23,7 +23,7 @@ use think\cache\Driver;
 class Redis extends Driver
 {
     protected $options = [
-        'host'       => '127.0.0.1',
+        'host'       => 'devredis',
         'port'       => 6379,
         'password'   => '',
         'select'     => 0,

+ 1 - 1
thinkphp/library/think/session/driver/Redis.php

@@ -19,7 +19,7 @@ class Redis implements SessionHandlerInterface
     /** @var \Redis */
     protected $handler = null;
     protected $config  = [
-        'host'         => '127.0.0.1', // redis主机
+        'host'         => 'devredis', // redis主机
         'port'         => 6379, // redis端口
         'password'     => '', // 密码
         'select'       => 0, // 操作库