Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
ErrNotFound key not found in store
Functions ¶
This section is empty.
Types ¶
type Deserializer ¶
Deserializer interface to tell storage how to deserialize
type DiskStorage ¶
type DiskStorage struct {
// contains filtered or unexported fields
}
DiskStorage persistence storage on disk
func (*DiskStorage) Delete ¶
func (d *DiskStorage) Delete(key string) error
Delete key in disk storage
func (*DiskStorage) Get ¶
func (d *DiskStorage) Get(key string) (interface{}, error)
Get value in disk storage
func (*DiskStorage) List ¶
func (d *DiskStorage) List() ([]interface{}, error)
List values in disk storage
func (*DiskStorage) Put ¶
func (d *DiskStorage) Put(key string, value interface{}) error
Put somethings into disk storage
type MemoryStorage ¶
type MemoryStorage struct {
// contains filtered or unexported fields
}
MemoryStorage is in memory storage
func NewMemoryStorage ¶
func NewMemoryStorage() *MemoryStorage
NewMemoryStorage return new in memory storage
func (*MemoryStorage) Delete ¶
func (m *MemoryStorage) Delete(key string) error
Delete key in memory storage
func (*MemoryStorage) Get ¶
func (m *MemoryStorage) Get(key string) (interface{}, error)
Get value in memory storage
func (*MemoryStorage) List ¶
func (m *MemoryStorage) List() ([]interface{}, error)
List values in memory storage
func (*MemoryStorage) Put ¶
func (m *MemoryStorage) Put(key string, value interface{}) error
Put somethings into memory storage
type Serializer ¶
Serializer interface to tell storage how to serialize object
type Storage ¶
type Storage interface { Put(key string, value interface{}) error Get(key string) (interface{}, error) List() ([]interface{}, error) Delete(key string) error }
Storage persistent storage on disk
func NewDiskStorage ¶
func NewDiskStorage(name string, path string, serializer Serializer, deserializer Deserializer) (Storage, error)
NewDiskStorage return new disk storage
Click to show internal directories.
Click to hide internal directories.