Documentation
¶
Index ¶
Constants ¶
View Source
const ( NoExpire time.Duration = 0 DefaultTimer = time.Second * 30 )
Timers
View Source
const ( // OrederSet: true | false TableOptionOrderedSet = "ordered_set" // ValueMode TableOptionValueMode = "value_mode" )
TableOptionSets
Variables ¶
View Source
var ( ErrTableExists = errors.New("table already exists") ErrNewTableCache = errors.New("failed new table") ErrOrderSetMustBeBool = errors.New("order set must be bool") ErrUnknownTableOption = errors.New("unknown table option") ErrUnknownTableValueMode = errors.New("unknown table value mode") )
errors
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { // Returns a list of all tables at the node. All() []string // Get TableCache GetTableCache(tab string) (TableCache, bool) // Creates a new table. New(tab string, options ...Option) error // Inserts the object or all of the objects in list. Insert(tab, key string, value interface{}) bool // Inserts the object or all of the objects with expired time in list. InsertExpire(tab, key string, value interface{}, expire time.Duration) bool // Deletes the entire table Tab. Delete(tab string) bool // Deletes all objects with key, Key from table Tab. DeleteObject(tab, key string) bool // Delete all objects in the table Tab. Remain table in cache. DeleteAllObjects(tab string) bool // Look up values with key, Key from table Tab. Lookup(tab, key string) ([]interface{}, bool) // Look up all values in the Tab. LookupAll(tab string) (map[string][]interface{}, bool) // Look up pos to limit, table order set must be true // if limit equals 0, to table's end LookupLimit(tab string, pos, limit uint) (map[string][]interface{}, bool) // Returns true if one or more elements in the table has key Key, otherwise false. Member(tab, key string) bool // Retruns all keys in the table Tab. Members(tab string) ([]string, bool) // Set key Key expire time in the table Tab. SetExpire(tab, key string, expire time.Duration) bool }
Cache Manager functions for executing k-v tables base on TableCache
type DataValues ¶
DataValues define k-vs struct
type TableCache ¶
type TableCache interface { // Inserts the object or all of the objects in list. Insert(key string, values interface{}) bool // Inserts the object or all of the objects with expired time in list. InsertExpire(key string, value interface{}, expire time.Duration) bool // Deletes all objects with key: Key. DeleteObject(key string) bool // Delete all objects in the table Tab. Remain table in cache. DeleteObjects() bool // Returns true if one or more elements in the table has key: Key, otherwise false. Member(key string) bool // Retruns all keys in the table Tab. Members() ([]string, bool) // Look up values with key: Key. Lookup(key string) ([]interface{}, bool) // Look up all values in the Tab. LookupAll() (map[string][]interface{}, bool) // Look up pos to limit, table order set must be true // if limit equals 0, to table's end LookupLimit(pos, limit uint) (map[string][]interface{}, bool) // Set Key Expire time SetExpire(key string, expire time.Duration) bool // Set background expired time, default: 30s SetBackgroundExpiredTime(time.Duration) }
TableCache table manager for k-vs functions
func NewTableCache ¶
func NewTableCache(name string, options ...Option) (TableCache, error)
NewTableCache return table cache with input options
type ValueMode ¶
type ValueMode int
ValueMode define value mode
const ( // only one value ValueModeUnique ValueMode = iota // The table is a bag table, which can have many objects // but only one instance of each object, per key. ValueModeBag // The table is a duplicate_bag table, which can have many objects, // including multiple copies of the same object, per key. ValueModeDuplicateBag )
ValueMode
Click to show internal directories.
Click to hide internal directories.