badgerdb

package
v0.0.0-...-da200cc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright 2018 The Redix Authors. All rights reserved. Use of this source code is governed by a Apache 2.0 license that can be found in the LICENSE file.

badger is a db engine based on badgerdb

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadgerDB

type BadgerDB struct {
	// contains filtered or unexported fields
}

BadgerDB - represents a badger db implementation

func OpenBadger

func OpenBadger(path string) (*BadgerDB, error)

OpenBadger - Opens the specified path

func SetBadger

func SetBadger(bdb *badger.DB) (*BadgerDB, error)

func (*BadgerDB) Close

func (db *BadgerDB) Close()

Close ...

func (*BadgerDB) Del

func (db *BadgerDB) Del(keys []string) error

Del - removes key(s) from the store

func (*BadgerDB) GC

func (db *BadgerDB) GC() error

GC - runs the garbage collector

func (*BadgerDB) Get

func (db *BadgerDB) Get(k string) (string, error)

Get - fetches the value of the specified k

func (*BadgerDB) Has

func (db *BadgerDB) Has(k string) bool

Has 判断某个key是否存在

func (*BadgerDB) Incr

func (db *BadgerDB) Incr(k string, by int64) (int64, error)

Incr - increment the key by the specified value

func (*BadgerDB) MGet

func (db *BadgerDB) MGet(keys []string) (data []string)

MGet - fetch multiple values of the specified keys

func (*BadgerDB) MSet

func (db *BadgerDB) MSet(data map[string]string) error

MSet - sets multiple key-value pairs

func (*BadgerDB) Scan

func (db *BadgerDB) Scan(scannerOpt kvstore.ScannerOptions) error

Scan - iterate over the whole store using the handler function

func (*BadgerDB) Set

func (db *BadgerDB) Set(k, v string, ttl int) error

Set - sets a key with the specified value and optional ttl

func (*BadgerDB) Size

func (db *BadgerDB) Size() int64

Size - returns the size of the database (LSM + ValueLog) in bytes

func (*BadgerDB) TTL

func (db *BadgerDB) TTL(key string) int64

TTL - returns the time to live of the specified key's value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL