Documentation ¶
Overview ¶
Package cacheutil is a base implementation of name-to-index cache on top of which all typesafe caches are built.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheHelper ¶
type CacheHelper struct { IDX idxvpp.NameToIdxRW Prefix string DataPrototype proto.Message ParseName func(key string) (name string, err error) }
CacheHelper is a helper which implementation is reused among multiple typesafe Caches. Beware: index stored in cached mapping is not valid. The meaningful values are the name and metadata.
func (*CacheHelper) DoChange ¶
func (helper *CacheHelper) DoChange(dataChng datasync.ChangeEvent) error
DoChange calls: - RegisterName in case of db.Put - UnregisterName in case of data.Del
func (*CacheHelper) DoResync ¶
func (helper *CacheHelper) DoResync(resyncEv datasync.ResyncEvent) error
DoResync list keys&values in ResyncEvent and then: - RegisterName (for names that are part of ResyncEvent) - UnregisterName (for names that are not part of ResyncEvent)
func (*CacheHelper) DoWatching ¶
func (helper *CacheHelper) DoWatching(resyncName string, watcher datasync.KeyValProtoWatcher)
DoWatching is supposed to be used as a go routine. It select the data from channels in arguments.
func (*CacheHelper) String ¶
func (helper *CacheHelper) String() string