Documentation
¶
Index ¶
- Variables
- type Option
- type Store
- func (s *Store) Close() error
- func (s *Store) Delete(namespace string, key []byte) error
- func (s *Store) DeleteNamespace(namespace string) error
- func (s *Store) Get(namespace, key []byte) ([]byte, error)
- func (s *Store) Load(key string, obj encoding.BinaryUnmarshaler) error
- func (s *Store) Memoize(key string, obj encoding.BinaryUnmarshaler, f func() (any, error)) error
- func (s *Store) MemoizeWithTTL(key string, obj encoding.BinaryUnmarshaler, f func() (any, error), ttl int64) error
- func (s *Store) Put(namespace string, key, value []byte) (err error)
- func (s *Store) PutWithTTL(namespace, key, value []byte, ttl int64) (err error)
- func (s *Store) Remove(key string) error
- func (s *Store) Update(key string, value encoding.BinaryMarshaler) error
- func (s *Store) UpdateWithTTL(key string, value encoding.BinaryMarshaler, ttl int64) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrKeyNotFound is returned when the key supplied to a Get or Delete // method does not exist in the database. ErrKeyNotFound = errors.New("key not found") // ErrKeyExpired is returned when the key supplied to a Get or Delete ErrKeyExpired = errors.New("key expired") // ErrBadValue is returned when the value supplied to the Put method // is nil or when a value doesn't implement the required interface. ErrBadValue = errors.New("bad value: value must implement encoding.BinaryMarshaler") // ErrInvalidInput is returned when input parameters are invalid ErrInvalidInput = errors.New("invalid input parameters") )
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*option) error
Option the tracer provider option
func WithMaxCacheSize ¶
WithMaxCacheSize sets the maximum number of items in the LRU cache.
func WithNumRetries ¶
WithNumRetries defines the number of retry attempts for database operations
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is KVStore implementation based bolt DB
func OpenMemory ¶ added in v1.2.2
OpenMemory opens a store in memory for testing purposes
func (*Store) DeleteNamespace ¶ added in v1.1.0
DeleteNamespace deletes a namespace
func (*Store) Load ¶
func (s *Store) Load(key string, obj encoding.BinaryUnmarshaler) error
Load read value by key
func (*Store) MemoizeWithTTL ¶ added in v1.1.0
func (*Store) PutWithTTL ¶ added in v1.1.0
PutWithTTL inserts a <key, value> record with TTL
func (*Store) Update ¶
func (s *Store) Update(key string, value encoding.BinaryMarshaler) error
Update set value by key, value must be implement encoding.BinaryMarshaler
func (*Store) UpdateWithTTL ¶ added in v1.1.0
UpdateWithTTL set value by key with TTL, value must be implement encoding.BinaryMarshaler
Click to show internal directories.
Click to hide internal directories.