Import path:
gitlab.soludian.com/soludian/fountain/libs/cache/buntdb
buntdb
import "gitlab.soludian.com/soludian/fountain/libs/cache/buntdb"Index
- Constants
- func NewBuntDB() cache.Cache
- type Cache
- func (rc *Cache) ClearAll(context.Context) error
- func (rc *Cache) Close() error
- func (rc *Cache) Decr(key string) (int64, error)
- func (rc *Cache) Delete(key string) error
- func (rc *Cache) Get(key string) ([]byte, error)
- func (rc *Cache) GetDefaultConfig() string
- func (rc *Cache) GetMulti(keys []string) ([][]byte, error)
- func (rc *Cache) Has(key string) bool
- func (rc *Cache) Incr(key string) (int64, error)
- func (rc *Cache) Peek(key string) (any, error)
- func (rc *Cache) PeekMulti(keys []string) ([]any, error)
- func (rc *Cache) Put(key string, val any, ttl time.Duration) error
- func (rc *Cache) PutMulti(values map[string]any, ttl time.Duration) error
- func (rc *Cache) Reset() error
- func (rc *Cache) Set(key string, val []byte, ttl time.Duration) error
- func (rc *Cache) SetMulti(values map[string][]byte, ttl time.Duration) error
- func (rc *Cache) SetName(name string)
- func (rc *Cache) StartAndGC(configs ...string) error
Constants
const (
KPackageName = "buntdb"
Memory = ":memory:" // Memory open a file that does not persist to disk.
)const DefaultConfig = `{}`func NewBuntDB
func NewBuntDB() cache.Cachetype Cache
type Cache struct {
// contains filtered or unexported fields
}func (*Cache) ClearAll
func (rc *Cache) ClearAll(context.Context) errorClearAll clears all cache in buntdb.
func (*Cache) Close
func (rc *Cache) Close() errorClose the database
func (*Cache) Decr
func (rc *Cache) Decr(key string) (int64, error)Decr decreases counter. Notice: The expiration will be not effective if you use Decr to increase the counter.
func (*Cache) Delete
func (rc *Cache) Delete(key string) errorDelete deletes a value in buntdb.
func (*Cache) Get
func (rc *Cache) Get(key string) ([]byte, error)Get gets a key's value from memcache.
func (*Cache) GetDefaultConfig
func (rc *Cache) GetDefaultConfig() stringfunc (*Cache) GetMulti
func (rc *Cache) GetMulti(keys []string) ([][]byte, error)GetMulti gets one or keys values from ssdb.
func (*Cache) Has
func (rc *Cache) Has(key string) boolHas checks if a value exists in buntdb.
func (*Cache) Incr
func (rc *Cache) Incr(key string) (int64, error)Incr increases counter. Notice: The expiration will be not effective if you use Incr to increase the counter.
func (*Cache) Peek
func (rc *Cache) Peek(key string) (any, error)Peek get value from buntdb. Return a string
func (*Cache) PeekMulti
func (rc *Cache) PeekMulti(keys []string) ([]any, error)PeekMulti gets a value from a key in buntdb. Return as string
func (*Cache) Put
func (rc *Cache) Put(key string, val any, ttl time.Duration) errorPut puts a value into buntdb.
func (*Cache) PutMulti
func (rc *Cache) PutMulti(values map[string]any, ttl time.Duration) errorfunc (*Cache) Reset
func (rc *Cache) Reset() errorfunc (*Cache) Set
func (rc *Cache) Set(key string, val []byte, ttl time.Duration) errorfunc (*Cache) SetMulti
func (rc *Cache) SetMulti(values map[string][]byte, ttl time.Duration) errorfunc (*Cache) SetName
func (rc *Cache) SetName(name string)func (*Cache) StartAndGC
func (rc *Cache) StartAndGC(configs ...string) errorStartAndGC starts the buntdb adapter. config: must be in the format {"file":"path/to/path"}. Default config file is :memory:
Generated by gomarkdoc