Documentation ¶
Index ¶
- Constants
- Variables
- func Persist(n *Nodis, conn *redis.Conn, cmd redis.Command)
- type GeoMember
- type Key
- type Nodis
- func (n *Nodis) Append(key string, value []byte) int64
- func (n *Nodis) BLPop(timeout time.Duration, keys ...string) (string, []byte)
- func (n *Nodis) BRPop(timeout time.Duration, keys ...string) (string, []byte)
- func (n *Nodis) BitCount(key string, start, end int64, bit bool) int64
- func (n *Nodis) Clear()
- func (n *Nodis) Close() error
- func (n *Nodis) Decr(key string) (int64, error)
- func (n *Nodis) DecrBy(key string, decrement int64) (int64, error)
- func (n *Nodis) Del(keys ...string) int64
- func (n *Nodis) Exists(keys ...string) int64
- func (n *Nodis) Expire(key string, seconds int64) int64
- func (n *Nodis) ExpireAt(key string, timestamp time.Time) int64
- func (n *Nodis) ExpireAtGT(key string, timestamp time.Time) int64
- func (n *Nodis) ExpireAtLT(key string, timestamp time.Time) int64
- func (n *Nodis) ExpireAtNX(key string, timestamp time.Time) int64
- func (n *Nodis) ExpireAtXX(key string, timestamp time.Time) int64
- func (n *Nodis) ExpireGT(key string, seconds int64) int64
- func (n *Nodis) ExpireLT(key string, seconds int64) int64
- func (n *Nodis) ExpireNX(key string, seconds int64) int64
- func (n *Nodis) ExpirePX(key string, milliseconds int64) int64
- func (n *Nodis) ExpireXX(key string, seconds int64) int64
- func (n *Nodis) GeoAdd(key string, members ...*GeoMember) int64
- func (n *Nodis) GeoAddNX(key string, members ...*GeoMember) int64
- func (n *Nodis) GeoAddXX(key string, members ...*GeoMember) int64
- func (n *Nodis) GeoDist(key string, member1, member2 string) (float64, error)
- func (n *Nodis) GeoHash(key string, members ...string) []string
- func (n *Nodis) GeoPos(key string, members ...string) []*GeoMember
- func (n *Nodis) GeoRadius(key string, longitude, latitude, radiusMeters float64, count int64, desc bool) ([]*GeoMember, error)
- func (n *Nodis) GeoRadiusByMember(key, member string, radiusMeters float64, count int64, desc bool) ([]*GeoMember, error)
- func (n *Nodis) Get(key string) []byte
- func (n *Nodis) GetBit(key string, offset int64) int64
- func (n *Nodis) GetEntry(key string) (data []byte)
- func (n *Nodis) GetRange(key string, start, end int64) []byte
- func (n *Nodis) GetSet(key string, value []byte) []byte
- func (n *Nodis) HClear(key string)
- func (n *Nodis) HDel(key string, fields ...string) int64
- func (n *Nodis) HExists(key string, field string) bool
- func (n *Nodis) HGet(key string, field string) []byte
- func (n *Nodis) HGetAll(key string) map[string][]byte
- func (n *Nodis) HIncrBy(key string, field string, value int64) (int64, error)
- func (n *Nodis) HIncrByFloat(key string, field string, value float64) (float64, error)
- func (n *Nodis) HKeys(key string) []string
- func (n *Nodis) HLen(key string) int64
- func (n *Nodis) HMGet(key string, fields ...string) [][]byte
- func (n *Nodis) HMSet(key string, fields map[string][]byte) int64
- func (n *Nodis) HScan(key string, cursor int64, match string, count int64) (int64, map[string][]byte)
- func (n *Nodis) HSet(key string, field string, value []byte) int64
- func (n *Nodis) HSetNX(key string, field string, value []byte) int64
- func (n *Nodis) HStrLen(key, field string) int64
- func (n *Nodis) HVals(key string) [][]byte
- func (n *Nodis) Incr(key string) (int64, error)
- func (n *Nodis) IncrBy(key string, increment int64) (int64, error)
- func (n *Nodis) IncrByFloat(key string, increment float64) (float64, error)
- func (n *Nodis) Keys(pattern string) []string
- func (n *Nodis) Keyspace() (keys int64, expires int64, avgTTL int64)
- func (n *Nodis) LIndex(key string, index int64) []byte
- func (n *Nodis) LInsert(key string, pivot, data []byte, before bool) int64
- func (n *Nodis) LLen(key string) int64
- func (n *Nodis) LPop(key string, count int64) [][]byte
- func (n *Nodis) LPopRPush(source, destination string) []byte
- func (n *Nodis) LPush(key string, values ...[]byte) int64
- func (n *Nodis) LPushX(key string, data []byte) int64
- func (n *Nodis) LRange(key string, start, stop int64) [][]byte
- func (n *Nodis) LRem(key string, data []byte, count int64) int64
- func (n *Nodis) LSet(key string, index int64, data []byte) bool
- func (n *Nodis) LTrim(key string, start, stop int64)
- func (n *Nodis) MSet(pairs ...string)
- func (n *Nodis) PTTL(key string) int64
- func (n *Nodis) Patch(ops ...*pb.Op) error
- func (n *Nodis) Persist(key string) int64
- func (n *Nodis) Publish(addr string, pattern []string) error
- func (n *Nodis) RPop(key string, count int64) [][]byte
- func (n *Nodis) RPopLPush(source, destination string) []byte
- func (n *Nodis) RPush(key string, values ...[]byte) int64
- func (n *Nodis) RPushX(key string, data []byte) int64
- func (n *Nodis) RandomKey() string
- func (n *Nodis) Rename(key, dstKey string) error
- func (n *Nodis) RenameNX(key, dstKey string) error
- func (n *Nodis) SAdd(key string, members ...string) int64
- func (n *Nodis) SCard(key string) int64
- func (n *Nodis) SDiff(keys ...string) []string
- func (n *Nodis) SDiffStore(destination string, keys ...string) int64
- func (n *Nodis) SInter(keys ...string) []string
- func (n *Nodis) SInterStore(destination string, keys ...string) int64
- func (n *Nodis) SIsMember(key, member string) bool
- func (n *Nodis) SMembers(key string) []string
- func (n *Nodis) SMove(source, destination, member string) bool
- func (n *Nodis) SPop(key string, count int64) []string
- func (n *Nodis) SRandMember(key string, count int64) []string
- func (n *Nodis) SRem(key string, members ...string) int64
- func (n *Nodis) SScan(key string, cursor int64, match string, count int64) (int64, []string)
- func (n *Nodis) SUnion(keys ...string) []string
- func (n *Nodis) SUnionStore(destination string, keys ...string) int64
- func (n *Nodis) Scan(cursor int64, match string, count int64, typ ds.ValueType) (int64, []string)
- func (n *Nodis) Serve(addr string) error
- func (n *Nodis) Set(key string, value []byte, keepTTL bool)
- func (n *Nodis) SetBit(key string, offset int64, value bool) int64
- func (n *Nodis) SetEX(key string, value []byte, seconds int64)
- func (n *Nodis) SetEntry(data []byte) error
- func (n *Nodis) SetNX(key string, value []byte, keepTTL bool) bool
- func (n *Nodis) SetPX(key string, value []byte, milliseconds int64)
- func (n *Nodis) SetRange(key string, offset int64, value []byte) int64
- func (n *Nodis) SetXX(key string, value []byte, keepTTL bool) bool
- func (n *Nodis) Snapshot(path string)
- func (n *Nodis) StrLen(key string) int64
- func (n *Nodis) Subscribe(addr string) error
- func (n *Nodis) TTL(key string) time.Duration
- func (n *Nodis) Type(key string) string
- func (n *Nodis) UnWatch(rn *redis.Conn, keys ...string)
- func (n *Nodis) UnWatchKey(id int)
- func (n *Nodis) Unlink(keys ...string) int64
- func (n *Nodis) Watch(rn *redis.Conn, keys ...string)
- func (n *Nodis) WatchKey(pattern []string, fn func(op *pb.Operation)) int
- func (n *Nodis) ZAdd(key string, member string, score float64) int64
- func (n *Nodis) ZAddGT(key string, member string, score float64) int64
- func (n *Nodis) ZAddLT(key string, member string, score float64) int64
- func (n *Nodis) ZAddNX(key string, member string, score float64) int64
- func (n *Nodis) ZAddXX(key string, member string, score float64) int64
- func (n *Nodis) ZCard(key string) int64
- func (n *Nodis) ZClear(key string)
- func (n *Nodis) ZCount(key string, min, max float64, mode int) int64
- func (n *Nodis) ZExists(key string, member string) bool
- func (n *Nodis) ZIncrBy(key string, member string, score float64) float64
- func (n *Nodis) ZInter(keys []string, weights []float64, aggregate string) []*zset.Item
- func (n *Nodis) ZInterStore(destination string, keys []string, weights []float64, aggregate string) int64
- func (n *Nodis) ZMax(key string) *zset.Item
- func (n *Nodis) ZMin(key string) *zset.Item
- func (n *Nodis) ZRange(key string, start int64, stop int64) []string
- func (n *Nodis) ZRangeByScore(key string, min float64, max float64, offset, count int64, mode int) []string
- func (n *Nodis) ZRangeByScoreWithScores(key string, min float64, max float64, offset, count int64, mode int) []*zset.Item
- func (n *Nodis) ZRangeWithScores(key string, start int64, stop int64) []*zset.Item
- func (n *Nodis) ZRank(key string, member string) (v int64, err error)
- func (n *Nodis) ZRankWithScore(key string, member string) (int64, *zset.Item)
- func (n *Nodis) ZRem(key string, members ...string) int64
- func (n *Nodis) ZRemRangeByRank(key string, start int64, stop int64) int64
- func (n *Nodis) ZRemRangeByScore(key string, min float64, max float64, mode int) int64
- func (n *Nodis) ZRevRange(key string, start int64, stop int64) []string
- func (n *Nodis) ZRevRangeByScore(key string, min float64, max float64, offset, count int64, mode int) []string
- func (n *Nodis) ZRevRangeByScoreWithScores(key string, min float64, max float64, offset, count int64, mode int) []*zset.Item
- func (n *Nodis) ZRevRangeWithScores(key string, start int64, stop int64) []*zset.Item
- func (n *Nodis) ZRevRank(key string, member string) (v int64, err error)
- func (n *Nodis) ZRevRankWithScore(key string, member string) (int64, *zset.Item)
- func (n *Nodis) ZScore(key string, member string) (v float64, err error)
- func (n *Nodis) ZUnion(keys []string, weights []float64, aggregate string) []*zset.Item
- func (n *Nodis) ZUnionStore(destination string, keys []string, weights []float64, aggregate string) int64
- type Options
- type Tx
Constants ¶
const ( KeyStateNormal uint8 = 1 KeyStateModified uint8 = 2 )
const ( FileSizeKB = 1024 FileSizeMB = 1024 * FileSizeKB FileSizeGB = 1024 * FileSizeMB )
Variables ¶
var DefaultOptions = &Options{ Path: "data", FileSize: FileSizeGB, TidyDuration: 60 * time.Second, }
var (
ErrCorruptedData = errors.New("corrupted data")
)
var (
ErrUnknownOperation = errors.New("unknown operation")
)
Functions ¶
Types ¶
type Nodis ¶
type Nodis struct {
// contains filtered or unexported fields
}
func (*Nodis) ExpireAtGT ¶ added in v1.5.0
ExpireAtGT the keys only when the new expiry is greater than current one
func (*Nodis) ExpireAtLT ¶ added in v1.5.0
ExpireAtLT the keys only when the new expiry is less than current one
func (*Nodis) ExpireAtNX ¶ added in v1.5.0
ExpireAtNX the keys only when the key has no expiry
func (*Nodis) ExpireAtXX ¶ added in v1.5.0
ExpireAtXX the keys only when the key has an existing expiry
func (*Nodis) ExpireGT ¶ added in v1.5.0
ExpireGT the keys only when the new expiry is greater than current one
func (*Nodis) ExpireLT ¶ added in v1.5.0
ExpireLT the keys only when the new expiry is less than current one
func (*Nodis) GeoAddNX ¶ added in v1.8.0
GeoAddNX adds the specified members to the key only if the member does not already exist.
func (*Nodis) GeoAddXX ¶ added in v1.8.0
GeoAddXX adds the specified members to the key only if the member already exists.
func (*Nodis) GeoRadiusByMember ¶ added in v1.8.0
func (*Nodis) GetRange ¶ added in v1.6.0
GetRange returns the substring of the string value stored at key, determined by the offsets start and end (both are inclusive).
func (*Nodis) HIncrByFloat ¶
func (*Nodis) HSetNX ¶
HSetNX Sets field in the hash stored at key to value, only if field does not yet exist. If key does not exist, a new key holding a hash is created. If field already exists, this operation has no effect.
func (*Nodis) IncrByFloat ¶ added in v1.6.0
func (*Nodis) SDiffStore ¶ added in v1.6.0
SDiffStore stores the difference between sets.
func (*Nodis) SInterStore ¶ added in v1.6.0
func (*Nodis) SPop ¶ added in v1.5.0
SPop removes and returns a random element from the set value stored at key.
func (*Nodis) SRandMember ¶ added in v1.6.0
SRandMember returns one or more random elements from the set value stored at key.
func (*Nodis) SUnionStore ¶ added in v1.6.0
func (*Nodis) SetEX ¶ added in v1.5.0
SetEX set a key with specified expire time, in seconds (a positive integer).
func (*Nodis) SetPX ¶ added in v1.5.0
SetPX set a key with specified expire time, in milliseconds (a positive integer).
func (*Nodis) SetRange ¶ added in v1.6.0
SetRange overwrite part of a string at key starting at the specified offset
func (*Nodis) UnWatchKey ¶ added in v1.8.0
func (*Nodis) ZAddXX ¶ added in v1.5.0
ZAddXX Only update elements that already exist. Don't add new elements.
func (*Nodis) ZCount ¶ added in v1.6.0
ZCount returns the number of elements in the sorted set at key with a score between min and max.
func (*Nodis) ZInterStore ¶ added in v1.6.0
func (n *Nodis) ZInterStore(destination string, keys []string, weights []float64, aggregate string) int64
ZInterStore computes the intersection of numkeys sorted sets given by the specified keys, and stores the result in destination.
func (*Nodis) ZMax ¶ added in v1.6.0
ZMax returns the member with the highest score in the sorted set at key.
func (*Nodis) ZMin ¶ added in v1.6.0
ZMin returns the member with the lowest score in the sorted set at key.
func (*Nodis) ZRangeByScore ¶
func (*Nodis) ZRangeByScoreWithScores ¶
func (*Nodis) ZRangeWithScores ¶
func (*Nodis) ZRankWithScore ¶ added in v1.5.0
func (*Nodis) ZRemRangeByRank ¶
func (*Nodis) ZRemRangeByScore ¶
func (*Nodis) ZRevRangeByScore ¶
func (*Nodis) ZRevRangeByScoreWithScores ¶
func (*Nodis) ZRevRangeWithScores ¶
func (*Nodis) ZRevRankWithScore ¶ added in v1.5.0
type Options ¶
type Options struct { // Path is the path to the database. Path string // TidyDuration is the interval which the database is flushing unused keys to disk. // This is useful for reducing the risk of data loss in the event of a crash. // It is also used for refreshing hot keys. TidyDuration time.Duration // MaxKeyUseTimes is the maximum number of times a key can be used before it is considered hot. // The default value is 0, which means that the key will never be considered hot. // Hot keys are refreshed every TidyDuration. MaxKeyUseTimes uint64 // FileSize is the size of each file. The default value is 1GB. FileSize int64 // SnapshotDuration is the interval at which the database is snapshot. // Default 0 for disabling snapshot. and you can call Snapshot manually. SnapshotDuration time.Duration // Filesystem is the filesystem to use. The default is the memory filesystem. Filesystem fs.Fs // Synchronizer is the synchronizer to use. The default is nil and no synchronization is performed. Synchronizer sync.Synchronizer }
Options represents the configuration options for the database.