Documentation ¶
Index ¶
- Constants
- type Cache
- type IndexSpecifier
- type KeyCreator
- type MemdbCache
- func (r *MemdbCache) Add(objs ...interface{}) error
- func (r *MemdbCache) Delete(objs ...interface{}) error
- func (r *MemdbCache) DeleteByPrefix(idxName, keyPrefix string) error
- func (r *MemdbCache) Dump() error
- func (r *MemdbCache) Get(idxName string, keyPrefix string, filter ObjectFilter) ([]interface{}, error)
- func (r *MemdbCache) GetKeyCreator(idxName string) (KeyCreator, error)
- func (r *MemdbCache) Init(indexSpecifiers ...IndexSpecifier) error
- func (r *MemdbCache) Update(mutator ObjectMutator, objs ...interface{}) error
- type ObjectFilter
- type ObjectMutator
Constants ¶
View Source
const AddressLinkObjectIndex = "addressLinkHierarchy"
View Source
const PrimaryObjectIndex = "id"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { Init(indexSpecifier ...IndexSpecifier) error Add(objs ...interface{}) error Update(mutator ObjectMutator, objs ...interface{}) error Delete(objs ...interface{}) error DeleteByPrefix(idxName, keyPrefix string) error Get(idxName string, keyPrefix string, filter ObjectFilter) ([]interface{}, error) Dump() error GetKeyCreator(idxName string) (KeyCreator, error) }
type IndexSpecifier ¶
type KeyCreator ¶
type MemdbCache ¶
type MemdbCache struct {
// contains filtered or unexported fields
}
func CreateObjectCache ¶
func CreateObjectCache() (*MemdbCache, error)
func (*MemdbCache) Add ¶
func (r *MemdbCache) Add(objs ...interface{}) error
func (*MemdbCache) Delete ¶
func (r *MemdbCache) Delete(objs ...interface{}) error
func (*MemdbCache) DeleteByPrefix ¶
func (r *MemdbCache) DeleteByPrefix(idxName, keyPrefix string) error
func (*MemdbCache) Dump ¶
func (r *MemdbCache) Dump() error
func (*MemdbCache) Get ¶
func (r *MemdbCache) Get(idxName string, keyPrefix string, filter ObjectFilter) ([]interface{}, error)
func (*MemdbCache) GetKeyCreator ¶
func (r *MemdbCache) GetKeyCreator(idxName string) (KeyCreator, error)
func (*MemdbCache) Init ¶
func (r *MemdbCache) Init(indexSpecifiers ...IndexSpecifier) error
func (*MemdbCache) Update ¶
func (r *MemdbCache) Update(mutator ObjectMutator, objs ...interface{}) error
type ObjectFilter ¶
ObjectFilters filter the objects return from a cache. return: - match, true if the object should be included in the results - cont, true if the traverse should continue - e in the event of a error preventing evaluation of the filter.
func And ¶
func And(filters ...ObjectFilter) ObjectFilter
type ObjectMutator ¶
type ObjectMutator = func(current interface{}) (replacement interface{}, e error)
ObjectMutator is used with Cache.Update function to mutate existing object(s) in the cache within a transaction. The ObjectMutator function receives the current value it uses to return a replacement Returning nil causes no change to be made for this value. Remaining objects will continue to be considered for update.
It is illegal for the updater function to mutate the object's key(s).
Click to show internal directories.
Click to hide internal directories.