cacheutil

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package cacheutil is a base implementation of name-to-index cache on the 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 the implementation of which 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 lists keys&values in ResyncEvent and then: - RegisterName (for names that are a part of ResyncEvent) - UnregisterName (for names that are not a 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 selects the data from the channels in arguments.

func (*CacheHelper) String

func (helper *CacheHelper) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL