23 lines
337 B
Go
23 lines
337 B
Go
package cache
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
func NewManager() Manager {
|
|
if strings.Contains(os.Getenv("PROFILE"), "redis") {
|
|
return newRedisCache()
|
|
} else {
|
|
return newInMemCache()
|
|
}
|
|
}
|
|
|
|
type Manager interface {
|
|
Set(key, value string, expiration time.Duration) error
|
|
Get(key string) (string, error)
|
|
Remove(key string)
|
|
}
|
|
|