Documentation
¶
Index ¶
- type CacheInterface
- type GoCache
- func (c *GoCache) ExtendTTL(cacheKey string, item interface{})
- func (c *GoCache) Get(cacheKey string) (interface{}, bool)
- func (c *GoCache) GetItemTTL(cacheKey string) (time.Duration, bool)
- func (c *GoCache) GetTTL() time.Duration
- func (c *GoCache) Init(cacheDuration time.Duration)
- func (c *GoCache) Set(cacheKey string, item interface{})
- type RedisCache
- func (c *RedisCache) ExtendTTL(cacheKey string, item interface{})
- func (c *RedisCache) Get(cacheKey string) (interface{}, bool)
- func (c *RedisCache) GetItemTTL(cacheKey string) (time.Duration, bool)
- func (c *RedisCache) GetTTL() time.Duration
- func (c *RedisCache) Init(cacheDuration time.Duration)
- func (c *RedisCache) Set(cacheKey string, item interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheInterface ¶
type CacheInterface interface {
Init(cacheDuration time.Duration)
Get(cacheKey string) (interface{}, bool)
Set(cacheKey string, item interface{})
GetItemTTL(cacheKey string) (time.Duration, bool)
GetTTL() time.Duration
ExtendTTL(cacheKey string, item interface{})
}
var CacheInstance CacheInterface
type RedisCache ¶
type RedisCache struct {
Cache *redis.Client
TTL time.Duration
CTX context.Context
Address string
DB int
}
func (*RedisCache) ExtendTTL ¶
func (c *RedisCache) ExtendTTL(cacheKey string, item interface{})
func (*RedisCache) Get ¶
func (c *RedisCache) Get(cacheKey string) (interface{}, bool)
func (*RedisCache) GetItemTTL ¶
func (c *RedisCache) GetItemTTL(cacheKey string) (time.Duration, bool)
func (*RedisCache) GetTTL ¶
func (c *RedisCache) GetTTL() time.Duration
func (*RedisCache) Init ¶
func (c *RedisCache) Init(cacheDuration time.Duration)
func (*RedisCache) Set ¶
func (c *RedisCache) Set(cacheKey string, item interface{})
Click to show internal directories.
Click to hide internal directories.