blog/jsondb/caches/null/null.go

36 lines
702 B
Go
Raw Permalink Normal View History

2017-12-23 21:22:51 +00:00
package null
// Null is a cache that doesn't do anything.
type Null struct{}
// New Null cache backend.
func New() *Null {
return &Null{}
}
// Get a key from Null.
func (r *Null) Get(key string) ([]byte, error) {
return []byte{}, nil
}
// Set a key in Null.
func (r *Null) Set(key string, v []byte, expires int) error {
return nil
}
// Delete keys from Null.
func (r *Null) Delete(key ...string) {}
// Keys returns a list of Null keys matching a pattern.
func (r *Null) Keys(pattern string) ([]string, error) {
return []string{}, nil
}
// Lock a mutex.
func (r *Null) Lock(key string, value string, expires int) bool {
return true
}
// Unlock a mutex.
func (r *Null) Unlock(key string) {}