Documentation ¶
Index ¶
- Variables
- type DB
- func (db *DB) AllKeys(bucket string) (keys [][]byte, err error)
- func (db *DB) Delete(bucket string, key []byte) (err error)
- func (db *DB) Get(bucket string, key []byte) (*nutsdb.Entry, error)
- func (db *DB) GetShard(bucket string) (shardDB *ShardDB)
- func (db *DB) LPeek(bucket string, key string) (item []byte, err error)
- func (db *DB) LPop(bucket, key string) (item []byte, err error)
- func (db *DB) LPush(bucket string, key string, values ...[]byte) error
- func (db *DB) LRange(bucket string, key string, start, end int) (list [][]byte, err error)
- func (db *DB) LRem(bucket string, key string, count int, value []byte) (removedNum int, err error)
- func (db *DB) LSet(bucket string, key string, index int, value []byte) error
- func (db *DB) LSize(bucket, key string) (size int, err error)
- func (db *DB) LTrim(bucket string, key string, start, end int) error
- func (db *DB) Managed(bucket string, writable bool, fn func(shardDB *ShardDB) error) error
- func (db *DB) PrefixScan(bucket string, prefix []byte, offsetNum int, limitNum int) (es nutsdb.Entries, off int, err error)
- func (db *DB) Put(bucket string, key, value []byte, ttl uint32) (err error)
- func (db *DB) RPeek(bucket, key string) (item []byte, err error)
- func (db *DB) RPop(bucket, key string) (item []byte, err error)
- func (db *DB) RPush(bucket string, key string, values ...[]byte) error
- func (db *DB) Range(bucket string, start, end []byte, f func(key, value []byte) bool) (err error)
- func (db *DB) SAdd(bucket string, key string, items ...[]byte) error
- func (db *DB) SAreMembers(bucket string, key string, items ...[]byte) (areMembers bool, err error)
- func (db *DB) SCard(bucket string, key string) (itemNumber int, err error)
- func (db *DB) SDiffByOneBucket(bucket string, key1, key2 string) (list [][]byte, err error)
- func (db *DB) SDiffByTwoBuckets(bucket1 string, key1 string, bucket2 string, key2 string) (list [][]byte, err error)
- func (db *DB) SHasKey(bucket string, key string) (hasKey bool, err error)
- func (db *DB) SIsMember(bucket string, key string, item []byte) (isMember bool, err error)
- func (db *DB) SMembers(bucket string, key string) (list [][]byte, err error)
- func (db *DB) SMoveByOneBucket(bucket, key1, key2 string, item []byte) (isOk bool, err error)
- func (db *DB) SMoveByTwoBuckets(bucket1 string, key1 string, bucket2 string, key2 string, item []byte) (isOK bool, err error)
- func (db *DB) SPop(bucket string, key string) (item []byte, err error)
- func (db *DB) SRem(bucket string, key string, items ...[]byte) error
- func (db *DB) SUnionByOneBucket(bucket string, key1, key2 string) (list [][]byte, err error)
- func (db *DB) SUnionByTwoBuckets(bucket1 string, key1 string, bucket2 string, key2 string) (list [][]byte, err error)
- func (db *DB) ZAdd(bucket string, key string, score float64, val []byte) error
- func (db *DB) ZCard(bucket string) (int, error)
- func (db *DB) ZCount(bucket string, start, end float64, opts *zset.GetByScoreRangeOptions) (int, error)
- func (db *DB) ZGetByKey(bucket string, key string) (node *zset.SortedSetNode, err error)
- func (db *DB) ZMembers(bucket string) (dict map[string]*zset.SortedSetNode, err error)
- func (db *DB) ZRangeByRank(bucket string, start, end int) (nodes []*zset.SortedSetNode, err error)
- func (db *DB) ZRangeByScore(bucket string, start, end float64, opts *zset.GetByScoreRangeOptions) (nodes []*zset.SortedSetNode, err error)
- func (db *DB) ZRank(bucket string, key string) (rank int, err error)
- func (db *DB) ZRem(bucket, key string) error
- func (db *DB) ZRemRangeByRank(bucket string, start, end int) error
- func (db *DB) ZRevRank(bucket string, key string) (rank int, err error)
- func (db *DB) ZScore(bucket string, key string) (score float64, err error)
- type Hasher
- type Option
- type Options
- type ShardDB
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = func() Options { return Options{ ShardsCount: 256, } }()
DefaultOptions default options
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct { Hasher Hasher // contains filtered or unexported fields }
DB indicates that all data is stored in memory. If the system restarts or crashes, all data will be lost.
func (*DB) LPeek ¶
LPeek returns the first element of the list stored in the bucket at given bucket and key.
func (*DB) LPop ¶
LPop removes and returns the first element of the list stored in the bucket at given bucket and key.
func (*DB) LPush ¶
LPush inserts the values at the head of the list stored in the bucket at given bucket,key and values.
func (*DB) LRange ¶
LRange returns the specified elements of the list stored in the bucket at given bucket,key, start and end. The offsets start and stop are zero-based indexes 0 being the first element of the list (the head of the list), 1 being the next element and so on. Start and end can also be negative numbers indicating offsets from the end of the list, where -1 is the last element of the list, -2 the penultimate element and so on.
func (*DB) LRem ¶
LRem removes the first count occurrences of elements equal to value from the list stored in the bucket at given bucket,key,count. The count argument influences the operation in the following ways: count > 0: Remove elements equal to value moving from head to tail. count < 0: Remove elements equal to value moving from tail to head. count = 0: Remove all elements equal to value.
func (*DB) LSize ¶
LSize returns the size of key in the bucket in the bucket at given bucket and key.
func (*DB) LTrim ¶
LTrim trims an existing list so that it will contain only the specified range of elements specified. the offsets start and stop are zero-based indexes 0 being the first element of the list (the head of the list), 1 being the next element and so on. start and end can also be negative numbers indicating offsets from the end of the list, where -1 is the last element of the list, -2 the penultimate element and so on.
func (*DB) PrefixScan ¶
func (db *DB) PrefixScan(bucket string, prefix []byte, offsetNum int, limitNum int) (es nutsdb.Entries, off int, err error)
PrefixScan iterates over a key prefix at given bucket, prefix and limitNum. LimitNum will limit the number of entries return.
func (*DB) RPeek ¶
RPeek returns the last element of the list stored in the bucket at given bucket and key.
func (*DB) RPop ¶
RPop removes and returns the last element of the list stored in the bucket at given bucket and key.
func (*DB) RPush ¶
RPush inserts the values at the tail of the list stored in the bucket at given bucket,key and values.
func (*DB) SAdd ¶
SAdd adds the specified members to the set stored int the bucket at given bucket,key and items.
func (*DB) SAreMembers ¶
SAreMembers returns if the specified members are the member of the set int the bucket at given bucket,key and items.
func (*DB) SCard ¶
SCard returns the set cardinality (number of elements) of the set stored in the bucket at given bucket and key.
func (*DB) SDiffByOneBucket ¶
SDiffByOneBucket returns the members of the set resulting from the difference between the first set and all the successive sets in one bucket.
func (*DB) SDiffByTwoBuckets ¶
func (db *DB) SDiffByTwoBuckets(bucket1 string, key1 string, bucket2 string, key2 string) (list [][]byte, err error)
SDiffByTwoBuckets returns the members of the set resulting from the difference between the first set and all the successive sets in two buckets.
func (*DB) SIsMember ¶
SIsMember returns if member is a member of the set stored int the bucket at given bucket,key and item.
func (*DB) SMembers ¶
SMembers returns all the members of the set value stored int the bucket at given bucket and key.
func (*DB) SMoveByOneBucket ¶
SMoveByOneBucket moves member from the set at source to the set at destination in one bucket.
func (*DB) SMoveByTwoBuckets ¶
func (db *DB) SMoveByTwoBuckets(bucket1 string, key1 string, bucket2 string, key2 string, item []byte) (isOK bool, err error)
SMoveByTwoBuckets moves member from the set at source to the set at destination in two buckets.
func (*DB) SPop ¶
SPop removes and returns one or more random elements from the set value store in the bucket at given bucket and key.
func (*DB) SRem ¶
SRem removes the specified members from the set stored int the bucket at given bucket,key and items.
func (*DB) SUnionByOneBucket ¶
SUnionByOneBucket the members of the set resulting from the union of all the given sets in one bucket.
func (*DB) SUnionByTwoBuckets ¶
func (db *DB) SUnionByTwoBuckets(bucket1 string, key1 string, bucket2 string, key2 string) (list [][]byte, err error)
SUnionByTwoBuckets the members of the set resulting from the union of all the given sets in two buckets.
func (*DB) ZAdd ¶
ZAdd adds the specified member key with the specified score and specified val to the sorted set stored at bucket.
func (*DB) ZCard ¶
ZCard returns the sorted set cardinality (number of elements) of the sorted set stored at bucket.
func (*DB) ZCount ¶
func (db *DB) ZCount(bucket string, start, end float64, opts *zset.GetByScoreRangeOptions) (int, error)
ZCount returns the number of elements in the sorted set at bucket with a score between min and max and opts. opts includes the following parameters: Limit int // limit the max nodes to return ExcludeStart bool // exclude start value, so it search in interval (start, end] or (start, end) ExcludeEnd bool // exclude end value, so it search in interval [start, end) or (start, end)
func (*DB) ZRangeByRank ¶
ZRangeByRank returns all the elements in the sorted set in one bucket and key with a rank between start and end (including elements with rank equal to start or end).
func (*DB) ZRangeByScore ¶
func (db *DB) ZRangeByScore(bucket string, start, end float64, opts *zset.GetByScoreRangeOptions) (nodes []*zset.SortedSetNode, err error)
ZRangeByScore returns all the elements in the sorted set at bucket with a score between min and max.
func (*DB) ZRank ¶
ZRank returns the rank of member in the sorted set stored in the bucket at given bucket and key, with the scores ordered from low to high.
func (*DB) ZRem ¶
ZRem removes the specified members from the sorted set stored in one bucket at given bucket and key.
func (*DB) ZRemRangeByRank ¶
ZRemRangeByRank removes all elements in the sorted set stored in one bucket at given bucket with rank between start and end. the rank is 1-based integer. Rank 1 means the first node; Rank -1 means the last node.
type Options ¶
type Options struct { // ShardsCount represents Number of cache shards. ShardsCount uint64 }