Documentation
¶
Index ¶
- func FetchData(key string, obj any) error
- func FetchDataWithCustomFunc(key string, obj any, getFunc func() (any, error)) error
- func GetCache(key string) (string, bool)
- func Init(config Config)
- func SetCache(key string, value string, expiration time.Duration) error
- func StoreData(obj any) (key string)
- type Cache
- type CacheType
- type Config
- type ConfigRedis
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchDataWithCustomFunc ¶
func GetCache ¶ added in v1.2.0
GetCache retrieves a value using the initialized cache implementation.
func Init ¶ added in v1.2.0
func Init(config Config)
Init initializes the global cache instance based on the configuration
Types ¶
type Cache ¶ added in v1.2.0
type Cache interface {
Set(key string, value string, expiration time.Duration) error
Get(key string) (string, bool)
}
Cache defines the behavior for our cache implementations
type Config ¶ added in v1.2.0
type Config struct {
Type CacheType `json:"type" yaml:"type"`
Redis ConfigRedis `json:"redis" yaml:"redis"`
}
Click to show internal directories.
Click to hide internal directories.