redis rpc服务, 提供redis操作方法
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
522 B

2 years ago
2 years ago
2 years ago
2 years ago
  1. package redisrpc
  2. import (
  3. "log"
  4. "net/rpc"
  5. "git.tetele.net/tgo/conf"
  6. )
  7. func Conn(url ...string) (*RedisServiceClient, *rpc.Client, error) {
  8. log.Println("conn redis rpc server========", url)
  9. var rpc_url string
  10. if len(url) > 0 && url[0] != "" {
  11. rpc_url = url[0]
  12. } else if conf.REDIS_RPC_URL != "" {
  13. rpc_url = conf.REDIS_RPC_URL
  14. } else {
  15. rpc_url = "127.0.0.1:" + conf.REDIS_RPC_PORT
  16. }
  17. log.Println("rpc_url", rpc_url, "conf.REDIS_RPC_URL", conf.REDIS_RPC_URL)
  18. return DialRedisService("tcp", rpc_url)
  19. }