Skip to content

Commit

Permalink
新增Redis支持
Browse files Browse the repository at this point in the history
Signed-off-by: sylar-yin <564628276@qq.com>
  • Loading branch information
sylar-yin committed Aug 14, 2019
1 parent 003c735 commit efab6d5
Show file tree
Hide file tree
Showing 9 changed files with 2,185 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ set(LIB_SRC
sylar/address.cc
sylar/bytearray.cc
sylar/config.cc
sylar/db/fox_thread.cc
sylar/db/mysql.cc
sylar/db/redis.cc
sylar/db/sqlite3.cc
sylar/ds/bitmap.cc
sylar/email/email.cc
Expand Down Expand Up @@ -139,6 +141,8 @@ set(LIBS
${ZLIB_LIBRARIES}
${OPENSSL_LIBRARIES}
${PROTOBUF_LIBRARIES}
event
hiredis_vip
mysqlclient_r
zookeeper_mt
sqlite3
Expand Down
5 changes: 5 additions & 0 deletions bin/conf/fox_thread.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fox_thread:
redis:
name: redis
num: 2
advance: 0
8 changes: 8 additions & 0 deletions bin/conf/redis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
redis:
config:
local:
host: 127.0.0.1:6379
type: fox_redis
pool: 2
timeout: 100
desc: "type: redis,redis_cluster,fox_redis,fox_redis_cluster"
7 changes: 7 additions & 0 deletions sylar/application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "sylar/http/ws_server.h"
#include "sylar/rock/rock_server.h"
#include "sylar/ns/name_server_module.h"
#include "sylar/db/fox_thread.h"
#include "sylar/db/redis.h"

namespace sylar {

Expand Down Expand Up @@ -159,7 +161,12 @@ int Application::run_fiber() {
if(has_error) {
_exit(0);
}

sylar::WorkerMgr::GetInstance()->init();
FoxThreadMgr::GetInstance()->init();
FoxThreadMgr::GetInstance()->start();
RedisMgr::GetInstance();

auto http_confs = g_servers_conf->getValue();
std::vector<TcpServer::ptr> svrs;
for(auto& i : http_confs) {
Expand Down
Loading

0 comments on commit efab6d5

Please sign in to comment.