func LookupURL(shortCode string) (model.URL, int) {
	var urlModel model.URL
	conn := Connection()
	if nil == conn {
		return urlModel, 0
	}
	defer conn.Close()
	line, err := conn.Do("GET", urlKey(model.URL{ShortCode: shortCode}))
	if err != nil || line == nil {
		return urlModel, 0
	}
	data := string(line.([]uint8))
	urlModel.OriginURL = data[1:]
	urlModel.ShortCode = shortCode
	if data[0:1] == "0" {
		return urlModel, http.StatusGone
	}
	return urlModel, http.StatusMovedPermanently
}
LookupURL looks up if certain short code is popular enough to be in cache
It returns model.URL so the request can be served right way without db hit.
package cache
import (
	"net/http"
	"net/url"
	"os"
	"sync"
	"time"
	"github.com/adhocore/urlsh/model"
	"github.com/gomodule/redigo/redis"
)
var once sync.Once
var pool *redis.Pool
var prefix = "url:"
func connect() {
	dsn := os.Getenv("REDIS_URL")
	if dsn == "" {
		dsn = os.Getenv("HEROKU_REDIS_MAUVE_URL")
	}
	if dsn == "" {
		return
	}
	parse, _ := url.Parse(dsn)
	user := parse.User.Username()
	pass, _ := parse.User.Password()
	pool = &redis.Pool{
		MaxIdle:     12,
		IdleTimeout: 300 * time.Second,
		Dial: func() (redis.Conn, error) {
			return redis.Dial("tcp", parse.Host, redis.DialUsername(user), redis.DialPassword(pass))
		},
	}
}
func Connection() redis.Conn {
	once.Do(connect)
	if nil != pool {
		return pool.Get()
	}
	return nil
}