resource_manager/domain/cache/manager.go

25 lines
433 B
Go
Raw Normal View History

2021-11-19 18:14:43 +00:00
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)
}