add store to defaults (#1086)

This commit is contained in:
Asim Aslam
2020-01-06 17:44:32 +00:00
committed by GitHub
parent df9055f69c
commit be6e8a7c78
5 changed files with 53 additions and 2 deletions

View File

@@ -9,6 +9,8 @@ import (
var (
// ErrNotFound is returned when a Read key doesn't exist
ErrNotFound = errors.New("not found")
// Default store
DefaultStore Store = new(noop)
)
// Store is a data storage interface
@@ -29,3 +31,21 @@ type Record struct {
Value []byte
Expiry time.Duration
}
type noop struct{}
func (n *noop) List() ([]*Record, error) {
return nil, nil
}
func (n *noop) Read(key ...string) ([]*Record, error) {
return nil, nil
}
func (n *noop) Write(rec ...*Record) error {
return nil
}
func (n *noop) Delete(key ...string) error {
return nil
}