Documentation ¶
Index ¶
- func ConvertToFloat64(unk interface{}) (float64, error)
- func ExitChannel() <-chan struct{}
- func ParamString(params config.StageParam, stage string, stageType string) string
- func SetupElegantExit()
- type CacheCallback
- type TimedCache
- func (tc *TimedCache) CleanupExpiredEntries(expiryTime int64, callback CacheCallback)
- func (tc *TimedCache) GetCacheEntry(key string) (interface{}, bool)
- func (tc *TimedCache) GetCacheLen() int
- func (tc *TimedCache) Iterate(f func(key string, value interface{}))
- func (tc *TimedCache) UpdateCacheEntry(key string, entry interface{}) *cacheEntry
- type TimedCacheMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToFloat64 ¶
ConvertToFloat64 converts an unknown type to float Based on https://stackoverflow.com/a/20767884/2749989
func ExitChannel ¶
func ExitChannel() <-chan struct{}
func ParamString ¶
func ParamString(params config.StageParam, stage string, stageType string) string
ParamString returns its corresponding (json) string from config.parameters for specified params structure
func SetupElegantExit ¶
func SetupElegantExit()
Types ¶
type CacheCallback ¶
type CacheCallback interface {
Cleanup(entry interface{})
}
type TimedCache ¶
type TimedCache struct {
// contains filtered or unexported fields
}
func NewTimedCache ¶
func NewTimedCache() *TimedCache
func (*TimedCache) CleanupExpiredEntries ¶
func (tc *TimedCache) CleanupExpiredEntries(expiryTime int64, callback CacheCallback)
CleanupExpiredEntries removes items from cache that were last touched more than expiryTime seconds ago
func (*TimedCache) GetCacheEntry ¶
func (tc *TimedCache) GetCacheEntry(key string) (interface{}, bool)
func (*TimedCache) GetCacheLen ¶
func (tc *TimedCache) GetCacheLen() int
func (*TimedCache) Iterate ¶
func (tc *TimedCache) Iterate(f func(key string, value interface{}))
We expect that the function calling Iterate might make updates to the entries by calling UpdateCacheEntry() We therefore cannot take the lock at this point since it will conflict with the call in UpdateCacheEntry() TODO: If the callback needs to update the cache, then we need a method to perform it without taking the lock again.
func (*TimedCache) UpdateCacheEntry ¶
func (tc *TimedCache) UpdateCacheEntry(key string, entry interface{}) *cacheEntry
type TimedCacheMap ¶
type TimedCacheMap map[string]*cacheEntry
Click to show internal directories.
Click to hide internal directories.