Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore is an implementation of Store that resides completely in memory.
func (*MemoryStore) Get ¶
func (s *MemoryStore) Get(key string, value interface{}) error
Get fetches the data stored in `key` and unmarshals it into `value`.
func (*MemoryStore) List ¶
func (s *MemoryStore) List(prefix string) ([]string, error)
List returns all the keys that start with `prefix`. The prefix is stripped from each returned value. So if keys are ["aa", "ab", "cd"] then List("a") would produce []string{"a", "b"}
func (*MemoryStore) Put ¶
func (s *MemoryStore) Put(key string, value interface{}) error
Put marshals `value` and stores it in `key`.
type Store ¶
type Store interface { // Get fetches the data stored in `key` and unmarshals it into `value`. Get(key string, value interface{}) error // Put marshals `value` and stores it in `key`. Put(key string, value interface{}) error // Delete removes `key` Delete(key string) error // List returns all the keys that start with `prefix`. The prefix is // stripped from each returned value. So if keys are ["aa", "ab", "cd"] // then List("a") would produce []string{"a", "b"} List(prefix string) ([]string, error) }
Click to show internal directories.
Click to hide internal directories.