Documentation
¶
Index ¶
- type Index
- type IndexFunc
- type Indexer
- type Indexers
- type Indices
- type LocalCache
- func (lc *LocalCache) Add(objectName, objectType string, objectBody interface{}, lockFree bool) error
- func (lc *LocalCache) AddIndexers(newIndexers Indexers) error
- func (lc *LocalCache) ByIndex(indexName, indexKey string) ([]interface{}, error)
- func (lc *LocalCache) ByMultipleIndex(indexKV map[string][]string) ([]interface{}, error)
- func (lc *LocalCache) Data() map[string]*ObjectDef
- func (lc *LocalCache) Delete(objectName, objectType string, objectBody interface{}, lockFree bool) error
- func (lc *LocalCache) GetIndexers() Indexers
- func (lc *LocalCache) Index(indexName string, obj interface{}) ([]interface{}, error)
- func (lc *LocalCache) Init() error
- func (lc *LocalCache) ListIndexFuncValues(indexName string) []string
- func (lc *LocalCache) Reset(data *map[string]*ObjectDef) error
- func (lc *LocalCache) Serialize(object interface{}) (string, error)
- func (lc *LocalCache) SerializedData() (string, error)
- func (lc *LocalCache) Update(objectName, objectType string, oldObjectBody, newObjectBody interface{}, ...) error
- type ObjectBody
- type ObjectDef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Indexer ¶
type Indexer interface { // Retrieve list of objects that match on the named indexing function Index(indexName string, obj interface{}) ([]interface{}, error) // ListIndexFuncValues returns the list of generated values of an Index func ListIndexFuncValues(indexName string) []string // ByIndex lists object that match on the named indexing function with the exact key ByIndex(indexName, indexKey string) ([]interface{}, error) // ByMultipleIndex lists object that match on named list indexing function with the exact key ByMultipleIndex(indexKV map[string][]string) ([]interface{}, error) // GetIndexer return the indexers GetIndexers() Indexers // AddIndexers adds more indexers to this store. If you call this after you already have data // in the store, the results are undefined. AddIndexers(newIndexers Indexers) error }
Indexer implement index method for cache, matched values are `ObjectName` in the other word, Primary key for the object in cache.
type LocalCache ¶
type LocalCache struct { ExpireTtl time.Duration OutOfDateTtl time.Duration // contains filtered or unexported fields }
func NewLocalCache ¶
func (*LocalCache) Add ¶
func (lc *LocalCache) Add(objectName, objectType string, objectBody interface{}, lockFree bool) error
func (*LocalCache) AddIndexers ¶
func (lc *LocalCache) AddIndexers(newIndexers Indexers) error
func (*LocalCache) ByIndex ¶
func (lc *LocalCache) ByIndex(indexName, indexKey string) ([]interface{}, error)
ByIndex returns a list of items that match an exact value on the index function
func (*LocalCache) ByMultipleIndex ¶
func (lc *LocalCache) ByMultipleIndex(indexKV map[string][]string) ([]interface{}, error)
ByMultipleIndex returns a list of items that both match the value for the index functions
func (*LocalCache) Data ¶
func (lc *LocalCache) Data() map[string]*ObjectDef
func (*LocalCache) Delete ¶
func (lc *LocalCache) Delete(objectName, objectType string, objectBody interface{}, lockFree bool) error
func (*LocalCache) GetIndexers ¶
func (lc *LocalCache) GetIndexers() Indexers
func (*LocalCache) Index ¶
func (lc *LocalCache) Index(indexName string, obj interface{}) ([]interface{}, error)
Index returns a list of items that match on the index function Index is thread-safe so long as you treat all items as immutable
func (*LocalCache) Init ¶
func (lc *LocalCache) Init() error
func (*LocalCache) ListIndexFuncValues ¶
func (lc *LocalCache) ListIndexFuncValues(indexName string) []string
func (*LocalCache) Serialize ¶
func (lc *LocalCache) Serialize(object interface{}) (string, error)
func (*LocalCache) SerializedData ¶
func (lc *LocalCache) SerializedData() (string, error)
type ObjectBody ¶
type ObjectBody interface{}
Click to show internal directories.
Click to hide internal directories.