Documentation
¶
Index ¶
- Constants
- type LazyCacheObject
- type LazyFDBHelper
- func (lfd *LazyFDBHelper) ClearLazyObjInterfaceData(identifier string) error
- func (lfd *LazyFDBHelper) GetCacheLength() int
- func (lfd *LazyFDBHelper) GetFromCache(newObject LazyCacheObject) (interface{}, bool)
- func (lfd *LazyFDBHelper) PurgeCache()
- func (lfd *LazyFDBHelper) RemoveDataFromCache(identifier string)
- func (lfd *LazyFDBHelper) RemoveDataFromCacheForAppend(identifier string)
- func (lfd *LazyFDBHelper) SaveOrUpdateDataInCache(newObject LazyCacheObject) bool
- func (lfd *LazyFDBHelper) StartProcess(objectCount int, taskName string, intervalTime int, sleepTime int, ...)
- func (lfd *LazyFDBHelper) StartProcessForAppend(objectCount int, taskName string, intervalTime int, sleepTime int, ...)
- type SaveDataFn
Constants ¶
View Source
const MIN_DATA_LENGTH = 10
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LazyCacheObject ¶
type LazyCacheObject struct {
// Identifier will be used to identify the LazyCacheObject
Identifier string
// This will be used as a Key for GC cache
FileName string
// Data is for storing byte array of an object; right now it is not used.
GJSONData gjson.Result
// This will hold object which developer wants to fetch or store
InterfaceData interface{}
//This number indicates how many times InterfaceData data is changed
ChangeCount int
// This will tell if object is locked for file saving or not.
IsLocked bool
MEMORY_WRITE_COUNT int
MEMORY_READ_COUNT int
DISK_READ_COUNT int
DISK_WRITE_COUNT int
SaveFn SaveDataFn
}
LazyCacheObject is a
type LazyFDBHelper ¶
type LazyFDBHelper struct {
Heartbeat *heartbeat.Task
IsProcessRunning bool
NumberOfUpdateAttempts int
MAX_NUMBER_OF_RETRY int
RETRY_SLEEP_TIME_SEC time.Duration
INTERVAL_TIME_SEC int
MEMORY_WRITE_COUNT int
MEMORY_READ_COUNT int
DISK_READ_COUNT int
DISK_WRITE_COUNT int
CacheExpirationTime time.Duration
CacheCleanUpInterval time.Duration
// contains filtered or unexported fields
}
LazyFDBHelper Helps to Save and Get cache object also saves information into hard disk
func (*LazyFDBHelper) ClearLazyObjInterfaceData ¶
func (lfd *LazyFDBHelper) ClearLazyObjInterfaceData(identifier string) error
ClearLazyObjInterfaceData -
func (*LazyFDBHelper) GetCacheLength ¶
func (lfd *LazyFDBHelper) GetCacheLength() int
GetCacheLength Get Cache Length
func (*LazyFDBHelper) GetFromCache ¶
func (lfd *LazyFDBHelper) GetFromCache(newObject LazyCacheObject) (interface{}, bool)
Get object based on key
func (*LazyFDBHelper) PurgeCache ¶
func (lfd *LazyFDBHelper) PurgeCache()
PurgeCache first saves all data inside FDB and finally purge all Cache
func (*LazyFDBHelper) RemoveDataFromCache ¶
func (lfd *LazyFDBHelper) RemoveDataFromCache(identifier string)
RemoveDataFromCache Removes Data From Cache
func (*LazyFDBHelper) RemoveDataFromCacheForAppend ¶
func (lfd *LazyFDBHelper) RemoveDataFromCacheForAppend(identifier string)
RemoveDataFromCacheForAppend Removes Data From Cache
func (*LazyFDBHelper) SaveOrUpdateDataInCache ¶
func (lfd *LazyFDBHelper) SaveOrUpdateDataInCache(newObject LazyCacheObject) bool
SaveOrUpdateDataInCache this method will Save object in cache if unavailable
func (*LazyFDBHelper) StartProcess ¶
func (lfd *LazyFDBHelper) StartProcess(objectCount int, taskName string, intervalTime int, sleepTime int, maxNumberOfRetry int, isDebugMode bool)
StartProcess
func (*LazyFDBHelper) StartProcessForAppend ¶
func (lfd *LazyFDBHelper) StartProcessForAppend(objectCount int, taskName string, intervalTime int, sleepTime int, maxNumberOfRetry int, isDebugMode bool)
StartProcessForAppend StartProcessForAppend
type SaveDataFn ¶
type SaveDataFn func(key string, value *LazyCacheObject)
SaveDataFn - This is an user defined callback function executed to presist data. If not provided default save function will be executed.
Click to show internal directories.
Click to hide internal directories.