kv.go 585 B

12345678910111213141516171819
  1. package kv
  2. type KeyValue interface {
  3. Open() error
  4. Close() error
  5. // Set key to hold string value if key does not exist otherwise return an error
  6. Setnx(key string, value interface{}) error
  7. // Set key to hold the string value. If key already holds a value, it is overwritten
  8. Set(key string, value interface{}) error
  9. Get(key string, val interface{}) (bool, error)
  10. //Must return *common.Error with NOT_FOUND error
  11. Delete(key string) error
  12. Keys() (keys []string, err error)
  13. Clean() error
  14. }
  15. func GetDefaultKVStore(fpath string) (ret KeyValue) {
  16. return GetSqliteKVStore(fpath)
  17. }