// NewCache creates a cache for dscache
NewCache creates a cache for dscache
// NewCache creates a cache for dscache
func NewCache(server string) *Cache {
	if server == "" {
		server = os.Getenv("REDIS_HOST")
		if server == "" {
			server = ":6379"
		}
	}
	return &Cache{
		Pool: &redis.Pool{
			MaxIdle:     3,
			IdleTimeout: 240 * time.Second,
			Dial: func() (redis.Conn, error) {
				c, err := redis.Dial("tcp", server)
				if err != nil {
					return nil, err
				}
				return c, err
			},
			TestOnBorrow: func(c redis.Conn, t time.Time) error {
				_, err := c.Do("PING")
				return err
			},
		},
	}
}
func NewCache ( server string ) * Cache { if server == " " { server = os . Getenv ( " " ) if server == " " { server = " " } } return & Cache { Pool : & redis . Pool { MaxIdle : 3 , IdleTimeout : 240 * time . Second , Dial : func ( ) ( redis . Conn , error ) { c , err := redis . Dial ( " " , server ) if err != nil { return nil , err } return c , err } , TestOnBorrow : func ( c redis . Conn , t time . Time ) error { _ , err := c . Do ( " " ) return err } , } , } }
NewCache creates a cache for dscache
NewCache creates a cache for dscache