redisdb

package
v0.0.0-...-005f04b Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Factory

func Factory(loader func(v interface{}) error) (kvdb.Driver, error)

Factory driver factory

Types

type Config

type Config struct {
	redispool.Config
	Prefix  string
	NoMulti bool
}

func (*Config) CreateDriver

func (c *Config) CreateDriver() (kvdb.Driver, error)

type Driver

type Driver struct {
	kvdb.Nop
	Pool    *redis.Pool
	NoMulti bool
	Prefix  string
}

func (*Driver) Close

func (d *Driver) Close() error

Close close database

func (*Driver) Delete

func (d *Driver) Delete(key []byte) error

Delete delete value by given key

func (*Driver) DeleteCounter

func (d *Driver) DeleteCounter(key []byte) error

DeleteCounter delete counter value with given key

func (*Driver) Features

func (d *Driver) Features() kvdb.Feature

Features return supported features

func (*Driver) Get

func (d *Driver) Get(key []byte) ([]byte, error)

Get get value by given key

func (*Driver) GetCounter

func (d *Driver) GetCounter(key []byte) (int64, error)

GetCounter get counter value with given key Value not existed coutn as 0.

func (*Driver) IncreaseCounter

func (d *Driver) IncreaseCounter(key []byte, incr int64) (int64, error)

IncreaseCounter increace counter value with given key and increasement. Value not existed coutn as 0. Return final value and any error if raised.

func (*Driver) IncreaseCounterWithTTL

func (d *Driver) IncreaseCounterWithTTL(key []byte, incr int64, ttlInSecond int64) (int64, error)

IncreaseCounterWithTTL increace counter value with given key ,increasement,and ttl in second Value not existed coutn as 0. Return final value and any error if raised.

func (*Driver) Insert

func (d *Driver) Insert(key []byte, value []byte) (bool, error)

Insert insert value with given key. Insert will fail if data with given key exists. Return if operation success and any error if raised

func (*Driver) InsertWithTTL

func (d *Driver) InsertWithTTL(key []byte, value []byte, ttlInSecond int64) (bool, error)

InsertWithTTL insert value with given key and ttl in second. Insert will fail if data with given key exists. Return if operation success and any error if raised

func (*Driver) Set

func (d *Driver) Set(key []byte, value []byte) error

Set set value by given key

func (*Driver) SetCounter

func (d *Driver) SetCounter(key []byte, value int64) error

SetCounter set counter value with given key

func (*Driver) SetCounterWithTTL

func (d *Driver) SetCounterWithTTL(key []byte, value int64, ttlInSecond int64) error

SetCounterWithTTL set counter value with given key and ttl in second

func (*Driver) SetWithTTL

func (d *Driver) SetWithTTL(key []byte, value []byte, ttlInSecond int64) error

SetWithTTL set value by given key and ttl in second

func (*Driver) Update

func (d *Driver) Update(key []byte, value []byte) (bool, error)

Update update value with given key. Update will fail if data with given key does nto exist. Return if operation success and any error if raised

func (*Driver) UpdateWithTTL

func (d *Driver) UpdateWithTTL(key []byte, value []byte, ttlInSecond int64) (bool, error)

UpdateWithTTL update value with given key and ttl in second. Update will fail if data with given key does nto exist. Return if operation success and any error if raised

Jump to

Keyboard shortcuts

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