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.

22 lines
387 B

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