// // Return the string pointer in the Redis Reply // // Redis/Casting Error --> error // Cache Miss --> nil ptr // Cache Hit --> valid ptr // func ReplyToStringPtr(reply *redis.Reply) (*string, error) { switch { case nil != reply.Err: return nil, reply.Err case redis.NilReply == reply.Type: return nil, nil case redis.IntegerReply == reply.Type: i64, err := reply.Int64() if nil != err { return nil, err } value := fmt.Sprintf("%d", i64) return &value, nil default: value, err := reply.Str() if nil != err { return nil, err } return &value, nil } }