Commit 723863ff authored by Akshay Bharambe's avatar Akshay Bharambe
Browse files

Remove: deprecated cache init functions and config

parent a5437d04
Branches
Tags
2 merge requests!210Staging mepdeployment05072020,!204Fix: CoreSLS is required as a dependency fro v2
Showing with 0 additions and 29 deletions
package cachemdl
import (
"errors"
"time"
)
......@@ -12,11 +11,6 @@ const (
TypeRedisCache
)
var (
// ErrInvalidCacheType indicates provided cache type is not supported
ErrInvalidCacheType = errors.New("invalid cache type provided")
)
// Cacher provides access to underlying cache, make sure all caches implement these methods.
//
// The return types of data can be different. Ex. In case of redis cache it is `string`. The caller needs to handle this with the help of Type() method.
......@@ -42,26 +36,3 @@ type Cacher interface {
Type() int
}
// GetCacheInstance returns a cache instance, panics if invalid cache type is provided
func GetCacheInstance(cfg *CacheConfig) Cacher {
switch cfg.Type {
case TypeFastCache:
cfg.FastCache.Setup(cfg.FastCache.MaxEntries, cfg.FastCache.Expiration, cfg.FastCache.CleanupTime)
return cfg.FastCache
case TypeRedisCache:
cfg.RedisCache.Setup(cfg.RedisCache.Addr, cfg.RedisCache.Password, cfg.RedisCache.Prefix, cfg.RedisCache.DB, cfg.RedisCache.Expiration)
return cfg.RedisCache
default:
panic(ErrInvalidCacheType)
}
}
// CacheConfig -
type CacheConfig struct {
Type int
FastCache *FastCacheHelper
RedisCache *RedisCache
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment