ErrInvalidCacheType=errors.New("invalid cache type provided")
)
var(
// Set @Setup(), CacheInUse provides current cache in use. We can take decision to perform cache specific operations with this.
CacheInUseint
// Set @setup(), if true, cache is already initialized
initializedbool
)
// 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.
//
// Ex.
// (Cacher{}).Type() == TypeRedisCache { // your implementation }
typeCacherinterface{
// SET
Set(keystring,valinterface{})
...
...
@@ -42,6 +39,8 @@ type Cacher interface {
// GetItemsCount
GetItemsCount()int
Type()int
}
// GetCacheInstance returns a cache instance, panics if invalid cache type is provided