Documentation
¶
Overview ¶
Package gostore is an in-memory key/value store
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item struct {
ID string // the unique item ID
Key string // the key in the key/value store
Value interface{} // the value in the key/value store
// contains filtered or unexported fields
}
Item is the item to be stored
type Store ¶
type Store interface {
// Init initializes the store
Init()
// Close stops all internal goroutines
Close()
// Put saves the item in the store given an optional expiry duration.
Put(item *Item, d time.Duration) error
// Get returns the item given the key
Get(key string) (item *Item, found bool, err error)
// Del deletes the item for the key
Del(key string) error
// ListPush adds the item to the list of items
ListPush(key string, value *Item) error
// ListGet returns the list of items given a key
ListGet(key string) (items []*Item, found bool, err error)
// ListDel deletes the item from the list
ListDel(key string, value *Item) error
// OnItemDidExpire adds the callback function to the list off callback functions
// called when an item expires
OnItemDidExpire(func(item *Item))
// OnListDidChange adds a callback to change in list
OnListDidChange(func(key string, items []*Item))
}
Store is the interface to the in-memory store
Click to show internal directories.
Click to hide internal directories.