resource_manager/domain/cache/manager.go

25 lines
433 B
Go

package cache
import (
"log"
"os"
"strings"
"time"
)
func NewManager() Manager {
if strings.Contains(os.Getenv("PROFILE"), "redis") {
log.Println("Cache | using redis cache")
return newRedisCache()
} else {
log.Println("Cache | using in memory cache")
return newInMemCache()
}
}
type Manager interface {
Set(key, value string, expiration time.Duration) error
Get(key string) (string, error)
Remove(key string)
}