Documentation
¶
Index ¶
- Variables
- type CacheManager
- func (cm *CacheManager) AddCacheRefresher(options CacheRefresherOptions) error
- func (cm *CacheManager) GetData(refresherID string, input string) (string, error)
- func (cm *CacheManager) GetManagerLock() *redisLock.Lock
- func (cm *CacheManager) Refresh(refresherID, inputJSON string, isForceReload bool) error
- func (cm *CacheManager) Start()
- type CacheRefreshCallback
- type CacheRefresherOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrWaitTooLong = errors.New(`SoftCache - The transaction is not proceeded due to long waiting. `)
Functions ¶
This section is empty.
Types ¶
type CacheManager ¶
type CacheManager struct {
RedisClient *redis.Client `inject:""`
LockFactory *redisLock.LockFactory `inject:""`
// contains filtered or unexported fields
}
func New ¶
func New( cacheRefreshingLockPrefix string, listLockName string, listName string, ) *CacheManager
func (*CacheManager) AddCacheRefresher ¶
func (cm *CacheManager) AddCacheRefresher(options CacheRefresherOptions) error
func (*CacheManager) GetData ¶
func (cm *CacheManager) GetData(refresherID string, input string) (string, error)
func (*CacheManager) GetManagerLock ¶
func (cm *CacheManager) GetManagerLock() *redisLock.Lock
func (*CacheManager) Refresh ¶
func (cm *CacheManager) Refresh(refresherID, inputJSON string, isForceReload bool) error
func (*CacheManager) Start ¶
func (cm *CacheManager) Start()
type CacheRefreshCallback ¶
type CacheRefresherOptions ¶
type CacheRefresherOptions struct {
Callback CacheRefreshCallback
TaskSetting *redisLock.LockOptions
HardTtl time.Duration // TTL set in Redis
SoftTtl time.Duration // TTL for SoftCache to refresh cache
}
func (CacheRefresherOptions) IsStillWithinSoftTTL ¶
func (rs CacheRefresherOptions) IsStillWithinSoftTTL(ttl time.Duration) bool
Click to show internal directories.
Click to hide internal directories.