func redisLinksLookup(client *redis.Client, req *http.Request, redisPath, prefix string) []string { f := client.Keys(redisPath) urls := []string{} for _, v := range f.Val() { url := fmt.Sprintf("http://%s%s/%s", req.Host, prefix, strings.Replace(v, ":", "/", -1)) urls = append(urls, url) } return urls }
func redisIntHash(client *redis.Client, redisPath string) map[string]int64 { f := client.HGetAll(redisPath) keys := []string{} vals := []int64{} counts := make(map[string]int64) for i, v := range f.Val() { if i%2 == 0 { keys = append(keys, v) } else { i, _ := strconv.ParseInt(v, 10, 0) vals = append(vals, i) } } for i, v := range keys { counts[v] = vals[i] } return counts }
// Returns false if the password does not match or if the user is not there func checkUserPass(user string, pass string, client *redis.Client) bool { if client.Exists("user:"******"user:"******"password").Val()[0].(string)) } return false }
func Get(client *redis.Client, key string) *redis.StringReq { req := redis.NewStringReq("GET", key) client.Process(req) return req }