Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Redis ¶
type Redis struct { Host string Port int Password string DB int IdleTimeout int MaxIdleConns int MaxOpenConns int InitialOpenConns int }
Redis struct
type RedisInterface ¶
type RedisInterface interface { StoreLongUrl2Redis(url string) string GetShortUrlFromRedis(key uint64) string }
RedisInterface define data interface
var RedisPool RedisInterface
RedisPool declare
func NewRedis ¶
func NewRedis(config Redis) (RedisInterface, error)
NewRedis generate redis instance
type RedisStorage ¶
type RedisStorage struct {
// contains filtered or unexported fields
}
RedisStorage represents redis pool
func (*RedisStorage) GetShortUrlFromRedis ¶
func (r *RedisStorage) GetShortUrlFromRedis(key uint64) string
GetShortUrlFromRedis acquire a long url with the short one
func (*RedisStorage) StoreLongUrl2Redis ¶
func (r *RedisStorage) StoreLongUrl2Redis(url string) string
StoreLongUrl2Redis store a long url to redis server
Click to show internal directories.
Click to hide internal directories.