func SavePopularURL(urlModel model.URL, force bool) {
	conn := Connection()
	if nil == conn || (!force && hasURL(urlModel)) {
		return
	}
	defer conn.Close()
	_, _ = conn.Do("SET", urlKey(urlModel), urlValue(urlModel))
}
SavePopularURL saves a model.URL to cache
If force is passed, it saves even if already exists
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
}
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
}
func DeactivateURL(urlModel model.URL) {
	cacheModel, _ := LookupURL(urlModel.ShortCode)
	if urlModel.OriginURL == "" {
		urlModel.OriginURL = cacheModel.OriginURL
	}
	SavePopularURL(urlModel, true)
}