Documentation
¶
Overview ¶
Package redi provides a Pure Go Redisson-like client for Redis 8.x.
Wire formats (key names, Lua scripts, value encoding) are aligned with Java Redisson configured with JsonJacksonCodec, and with the sibling ports redi.py (Python). See COMPATIBILITY.md for the per-structure status.
Index ¶
- Constants
- Variables
- func UnpackDelayedMember(v string) (string, string, bool)
- type Client
- func (c *Client) Close() error
- func (c *Client) Config() Config
- func (c *Client) GetArray(name string) *RArray
- func (c *Client) GetAtomicDouble(name string) *RAtomicDouble
- func (c *Client) GetAtomicLong(name string) *RAtomicLong
- func (c *Client) GetBinaryStream(name string) *RBinaryStream
- func (c *Client) GetBitSet(name string) *RBitSet
- func (c *Client) GetBlockingDeque(name string) *RBlockingDeque
- func (c *Client) GetBlockingQueue(name string) *RBlockingQueue
- func (c *Client) GetBloomFilter(name string) *RBloomFilter
- func (c *Client) GetBloomFilterNative(name string) *RBloomFilterNative
- func (c *Client) GetBoundedBlockingQueue(name string) *RBoundedBlockingQueue
- func (c *Client) GetBucket(name string) *RBucket
- func (c *Client) GetBuckets() *RBuckets
- func (c *Client) GetCircularBuffer(name string) *RCircularBuffer
- func (c *Client) GetClientSideCaching() *RClientSideCaching
- func (c *Client) GetClientSideCachingWithOptions(opts *ClientSideCachingOptions) (*RClientSideCaching, error)
- func (c *Client) GetCountDownLatch(name string) *RCountDownLatch
- func (c *Client) GetCuckooFilter(name string) *RCuckooFilter
- func (c *Client) GetDelayedQueue(name string) *RDelayedQueue
- func (c *Client) GetDeque(name string) *RDeque
- func (c *Client) GetDoubleAdder(name string) *RDoubleAdder
- func (c *Client) GetFairLock(name string) *RFairLock
- func (c *Client) GetFencedLock(name string) *RFencedLock
- func (c *Client) GetFunction() *RFunction
- func (c *Client) GetGcra(name string) *RGcra
- func (c *Client) GetGeo(name string) *RGeo
- func (c *Client) GetHyperLogLog(name string) *RHyperLogLog
- func (c *Client) GetIdGenerator(name string) *RIdGenerator
- func (c *Client) GetJsonBucket(name string) *RJsonBucket
- func (c *Client) GetJsonBuckets() *RJsonBuckets
- func (c *Client) GetKeys() *RKeys
- func (c *Client) GetLexSortedSet(name string) *RLexSortedSet
- func (c *Client) GetList(name string) *RList
- func (c *Client) GetListMultimap(name string) *RListMultimap
- func (c *Client) GetListMultimapCache(name string) *RListMultimapCache
- func (c *Client) GetListMultimapCacheNative(name string) *RListMultimapCacheNative
- func (c *Client) GetLocalCachedMap(name string) *RLocalCachedMap
- func (c *Client) GetLocalCachedMapWithOptions(name string, opts *LocalCachedMapOptions) *RLocalCachedMap
- func (c *Client) GetLock(name string) *RLock
- func (c *Client) GetLongAdder(name string) *RLongAdder
- func (c *Client) GetMap(name string) *RMap
- func (c *Client) GetMapCache(name string) *RMapCache
- func (c *Client) GetMapCacheNative(name string) *RMapCacheNative
- func (c *Client) GetMaps() *RMaps
- func (c *Client) GetMultiLock(locks ...*RLock) *RMultiLock
- func (c *Client) GetNonReentrantFairLock(name string) *RNonReentrantFairLock
- func (c *Client) GetNonReentrantLock(name string) *RNonReentrantLock
- func (c *Client) GetPatternTopic(pattern string) *RPatternTopic
- func (c *Client) GetPermitExpirableSemaphore(name string) *RPermitExpirableSemaphore
- func (c *Client) GetPriorityBlockingDeque(name string) *RPriorityBlockingDeque
- func (c *Client) GetPriorityBlockingQueue(name string) *RPriorityBlockingQueue
- func (c *Client) GetPriorityDeque(name string) *RPriorityDeque
- func (c *Client) GetPriorityQueue(name string) *RPriorityQueue
- func (c *Client) GetQueue(name string) *RQueue
- func (c *Client) GetQueueTransfer(name string) *RTransferQueue
- func (c *Client) GetRAtomicLong(name string) *RAtomicLong
- func (c *Client) GetRList(name string) *RList
- func (c *Client) GetRLock(name string) *RLock
- func (c *Client) GetRMap(name string) *RMap
- func (c *Client) GetRQueue(name string) *RQueue
- func (c *Client) GetRSet(name string) *RSet
- func (c *Client) GetRateLimiter(name string) *RRateLimiter
- func (c *Client) GetReadWriteLock(name string) *RReadWriteLock
- func (c *Client) GetRedisNodes() *RRedisNodes
- func (c *Client) GetReliableTopic(name string) *RReliableTopic
- func (c *Client) GetRingBuffer(name string) *RRingBuffer
- func (c *Client) GetScoredSortedSet(name string) *RScoredSortedSet
- func (c *Client) GetScript() *RScript
- func (c *Client) GetSearch() *RSearch
- func (c *Client) GetSemaphore(name string) *RSemaphore
- func (c *Client) GetSet(name string) *RSet
- func (c *Client) GetSetCache(name string) *RSetCache
- func (c *Client) GetSetMultimap(name string) *RSetMultimap
- func (c *Client) GetSetMultimapCache(name string) *RSetMultimapCache
- func (c *Client) GetSetMultimapCacheNative(name string) *RSetMultimapCacheNative
- func (c *Client) GetShardedTopic(name string) *RShardedTopic
- func (c *Client) GetSpinLock(name string) *RSpinLock
- func (c *Client) GetStream(name string) *RStream
- func (c *Client) GetTDigest(name string) *RTDigest
- func (c *Client) GetTimeSeries(name string) *RTimeSeries
- func (c *Client) GetTopK(name string) *RTopK
- func (c *Client) GetTopic(name string) *RTopic
- func (c *Client) GetTransferQueue(name string) *RTransferQueue
- func (c *Client) GetVectorSet(name string) *RVectorSet
- func (c *Client) HolderID(threadID string) string
- func (c *Client) ID() string
- func (c *Client) NewBatch() *RBatch
- func (c *Client) NewMultiLock(locks ...*RLock) *RMultiLock
- func (c *Client) NewRedLock(locks ...*RLock) *RRedLock
- func (c *Client) Redis() redis.UniversalClient
- type ClientSideCachingOptions
- type Codec
- type Config
- type EvictionMode
- type GcraResult
- type GeoEntry
- type GeoLocation
- type IndexField
- type IndexFieldType
- type IndexOptions
- type JSONCodec
- type LocalCachedMapOptions
- type Logger
- type Mode
- type MultimapEntry
- type PendingEntry
- type RArray
- func (a *RArray) Clear(ctx context.Context) error
- func (o *RArray) ClearExpire(ctx context.Context) (bool, error)
- func (a *RArray) Count(ctx context.Context) (int64, error)
- func (o *RArray) Delete(ctx context.Context) error
- func (a *RArray) DeleteIndexes(ctx context.Context, indexes ...int64) (int64, error)
- func (a *RArray) DeleteRange(ctx context.Context, start, end int64) (int64, error)
- func (o *RArray) Exists(ctx context.Context) (bool, error)
- func (o *RArray) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RArray) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (a *RArray) Get(ctx context.Context, index int64) (any, error)
- func (a *RArray) GetMulti(ctx context.Context, indexes ...int64) ([]any, error)
- func (a *RArray) Insert(ctx context.Context, values ...any) (int64, error)
- func (a *RArray) Length(ctx context.Context) (int64, error)
- func (o *RArray) Name() string
- func (a *RArray) Next(ctx context.Context) (int64, error)
- func (a *RArray) Range(ctx context.Context, start, end int64) ([]any, error)
- func (o *RArray) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RArray) Rename(ctx context.Context, newName string) error
- func (a *RArray) Seek(ctx context.Context, index int64) (bool, error)
- func (a *RArray) Set(ctx context.Context, index int64, value any) (int64, error)
- func (a *RArray) SetAll(ctx context.Context, index int64, values ...any) (int64, error)
- func (a *RArray) SetEntries(ctx context.Context, entries map[int64]any) (int64, error)
- func (o *RArray) Touch(ctx context.Context) (bool, error)
- func (o *RArray) Unlink(ctx context.Context) error
- type RAtomicDouble
- func (a *RAtomicDouble) AddAndGet(ctx context.Context, delta float64) (float64, error)
- func (o *RAtomicDouble) ClearExpire(ctx context.Context) (bool, error)
- func (a *RAtomicDouble) CompareAndSet(ctx context.Context, expect, newVal float64) (bool, error)
- func (a *RAtomicDouble) DecrementAndGet(ctx context.Context) (float64, error)
- func (o *RAtomicDouble) Delete(ctx context.Context) error
- func (o *RAtomicDouble) Exists(ctx context.Context) (bool, error)
- func (o *RAtomicDouble) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RAtomicDouble) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (a *RAtomicDouble) Get(ctx context.Context) (float64, error)
- func (a *RAtomicDouble) GetAndAdd(ctx context.Context, delta float64) (float64, error)
- func (a *RAtomicDouble) GetAndDecrement(ctx context.Context) (float64, error)
- func (a *RAtomicDouble) GetAndDelete(ctx context.Context) (float64, error)
- func (a *RAtomicDouble) GetAndIncrement(ctx context.Context) (float64, error)
- func (a *RAtomicDouble) GetAndSet(ctx context.Context, value float64) (float64, error)
- func (a *RAtomicDouble) IncrementAndGet(ctx context.Context) (float64, error)
- func (o *RAtomicDouble) Name() string
- func (o *RAtomicDouble) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RAtomicDouble) Rename(ctx context.Context, newName string) error
- func (a *RAtomicDouble) Set(ctx context.Context, value float64) (float64, error)
- func (a *RAtomicDouble) SetIfGreater(ctx context.Context, threshold, value float64) (bool, error)
- func (a *RAtomicDouble) SetIfLess(ctx context.Context, threshold, value float64) (bool, error)
- func (o *RAtomicDouble) Touch(ctx context.Context) (bool, error)
- func (o *RAtomicDouble) Unlink(ctx context.Context) error
- type RAtomicLong
- func (a *RAtomicLong) AddAndGet(ctx context.Context, delta int64) (int64, error)
- func (o *RAtomicLong) ClearExpire(ctx context.Context) (bool, error)
- func (a *RAtomicLong) CompareAndDelete(ctx context.Context, expect int64) (bool, error)
- func (a *RAtomicLong) CompareAndSet(ctx context.Context, expect, newVal int64) (bool, error)
- func (a *RAtomicLong) DecrementAndGet(ctx context.Context) (int64, error)
- func (o *RAtomicLong) Delete(ctx context.Context) error
- func (o *RAtomicLong) Exists(ctx context.Context) (bool, error)
- func (o *RAtomicLong) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RAtomicLong) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (a *RAtomicLong) Get(ctx context.Context) (int64, error)
- func (a *RAtomicLong) GetAndAdd(ctx context.Context, delta int64) (int64, error)
- func (a *RAtomicLong) GetAndDecrement(ctx context.Context) (int64, error)
- func (a *RAtomicLong) GetAndDelete(ctx context.Context) (int64, error)
- func (a *RAtomicLong) GetAndIncrement(ctx context.Context) (int64, error)
- func (a *RAtomicLong) GetAndSet(ctx context.Context, value int64) (int64, error)
- func (a *RAtomicLong) IncrementAndGet(ctx context.Context) (int64, error)
- func (o *RAtomicLong) Name() string
- func (o *RAtomicLong) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RAtomicLong) Rename(ctx context.Context, newName string) error
- func (a *RAtomicLong) Set(ctx context.Context, value int64) (int64, error)
- func (a *RAtomicLong) SetIfGreater(ctx context.Context, threshold, value int64) (bool, error)
- func (a *RAtomicLong) SetIfLess(ctx context.Context, threshold, value int64) (bool, error)
- func (o *RAtomicLong) Touch(ctx context.Context) (bool, error)
- func (o *RAtomicLong) Unlink(ctx context.Context) error
- type RBatch
- func (b *RBatch) Discard()
- func (b *RBatch) Execute(ctx context.Context) error
- func (b *RBatch) GetAtomicDouble(name string) *RAtomicDouble
- func (b *RBatch) GetAtomicLong(name string) *RAtomicLong
- func (b *RBatch) GetBucket(name string) *RBucket
- func (b *RBatch) GetDeque(name string) *RDeque
- func (b *RBatch) GetList(name string) *RList
- func (b *RBatch) GetMap(name string) *RMap
- func (b *RBatch) GetQueue(name string) *RQueue
- func (b *RBatch) GetScoredSortedSet(name string) *RScoredSortedSet
- func (b *RBatch) GetSet(name string) *RSet
- func (b *RBatch) Len() int
- type RBinaryStream
- func (s *RBinaryStream) Append(ctx context.Context, data []byte) (int64, error)
- func (o *RBinaryStream) ClearExpire(ctx context.Context) (bool, error)
- func (o *RBinaryStream) Delete(ctx context.Context) error
- func (o *RBinaryStream) Exists(ctx context.Context) (bool, error)
- func (o *RBinaryStream) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RBinaryStream) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (s *RBinaryStream) Get(ctx context.Context) ([]byte, error)
- func (s *RBinaryStream) GetChannel(ctx context.Context) *RBinaryStreamChannel
- func (s *RBinaryStream) GetInputStream(ctx context.Context) *RBinaryStreamReader
- func (s *RBinaryStream) GetOutputStream(ctx context.Context) *RBinaryStreamWriter
- func (o *RBinaryStream) Name() string
- func (s *RBinaryStream) Read(ctx context.Context, offset, length int64) ([]byte, error)
- func (o *RBinaryStream) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RBinaryStream) Rename(ctx context.Context, newName string) error
- func (s *RBinaryStream) Set(ctx context.Context, data []byte) error
- func (s *RBinaryStream) Size(ctx context.Context) (int64, error)
- func (o *RBinaryStream) Touch(ctx context.Context) (bool, error)
- func (s *RBinaryStream) Truncate(ctx context.Context, size int64) error
- func (o *RBinaryStream) Unlink(ctx context.Context) error
- func (s *RBinaryStream) Write(ctx context.Context, offset int64, data []byte) (int, error)
- type RBinaryStreamChannel
- func (c *RBinaryStreamChannel) Close() error
- func (c *RBinaryStreamChannel) IsOpen() bool
- func (c *RBinaryStreamChannel) Position() int64
- func (c *RBinaryStreamChannel) Read(p []byte) (int, error)
- func (c *RBinaryStreamChannel) Seek(offset int64, whence int) (int64, error)
- func (c *RBinaryStreamChannel) Size() (int64, error)
- func (c *RBinaryStreamChannel) Truncate(size int64) error
- func (c *RBinaryStreamChannel) Write(p []byte) (int, error)
- type RBinaryStreamReader
- type RBinaryStreamWriter
- type RBitSet
- func (b *RBitSet) And(ctx context.Context, others ...string) error
- func (b *RBitSet) AndOr(ctx context.Context, others ...string) (int64, error)
- func (b *RBitSet) BitFieldGet(ctx context.Context, signed bool, width int, offset int64) (int64, error)
- func (b *RBitSet) BitFieldIncrBy(ctx context.Context, signed bool, width int, offset, increment int64) (int64, error)
- func (b *RBitSet) BitFieldSet(ctx context.Context, signed bool, width int, offset, value int64) (int64, error)
- func (b *RBitSet) Cardinality(ctx context.Context) (int64, error)
- func (b *RBitSet) Clear(ctx context.Context, bitIndex int64) (bool, error)
- func (b *RBitSet) ClearAll(ctx context.Context) error
- func (o *RBitSet) ClearExpire(ctx context.Context) (bool, error)
- func (b *RBitSet) ClearRange(ctx context.Context, from, toInclusive int64) error
- func (o *RBitSet) Delete(ctx context.Context) error
- func (b *RBitSet) Diff(ctx context.Context, others ...string) (int64, error)
- func (o *RBitSet) Exists(ctx context.Context) (bool, error)
- func (o *RBitSet) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RBitSet) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (b *RBitSet) FromByteArray(ctx context.Context, data []byte) error
- func (b *RBitSet) Get(ctx context.Context, bitIndex int64) (bool, error)
- func (b *RBitSet) GetMany(ctx context.Context, indexes ...int64) ([]bool, error)
- func (b *RBitSet) Length(ctx context.Context) (int64, error)
- func (o *RBitSet) Name() string
- func (b *RBitSet) Not(ctx context.Context, source ...string) error
- func (b *RBitSet) Or(ctx context.Context, others ...string) error
- func (o *RBitSet) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RBitSet) Rename(ctx context.Context, newName string) error
- func (b *RBitSet) Set(ctx context.Context, bitIndex int64, value bool) (bool, error)
- func (b *RBitSet) SetExclusive(ctx context.Context, others ...string) (int64, error)
- func (b *RBitSet) SetMany(ctx context.Context, value bool, indexes ...int64) error
- func (b *RBitSet) SetRange(ctx context.Context, from, toInclusive int64) error
- func (b *RBitSet) Size(ctx context.Context) (int64, error)
- func (b *RBitSet) ToByteArray(ctx context.Context) ([]byte, error)
- func (o *RBitSet) Touch(ctx context.Context) (bool, error)
- func (o *RBitSet) Unlink(ctx context.Context) error
- func (b *RBitSet) Xor(ctx context.Context, others ...string) error
- type RBlockingDeque
- func (o RBlockingDeque) ClearExpire(ctx context.Context) (bool, error)
- func (o RBlockingDeque) Delete(ctx context.Context) error
- func (o RBlockingDeque) Exists(ctx context.Context) (bool, error)
- func (o RBlockingDeque) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o RBlockingDeque) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o RBlockingDeque) Name() string
- func (d *RBlockingDeque) PollFirstWithTimeout(ctx context.Context, timeout time.Duration) (any, error)
- func (d *RBlockingDeque) PollLastWithTimeout(ctx context.Context, timeout time.Duration) (any, error)
- func (o RBlockingDeque) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o RBlockingDeque) Rename(ctx context.Context, newName string) error
- func (d *RBlockingDeque) TakeFirst(ctx context.Context) (any, error)
- func (d *RBlockingDeque) TakeLast(ctx context.Context) (any, error)
- func (o RBlockingDeque) Touch(ctx context.Context) (bool, error)
- func (o RBlockingDeque) Unlink(ctx context.Context) error
- type RBlockingQueue
- func (o RBlockingQueue) ClearExpire(ctx context.Context) (bool, error)
- func (o RBlockingQueue) Delete(ctx context.Context) error
- func (o RBlockingQueue) Exists(ctx context.Context) (bool, error)
- func (o RBlockingQueue) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o RBlockingQueue) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o RBlockingQueue) Name() string
- func (q *RBlockingQueue) PollFromAny(ctx context.Context, timeout time.Duration, otherNames ...string) (any, error)
- func (q *RBlockingQueue) PollLastAndOfferFirstTo(ctx context.Context, dest string, timeout time.Duration) (any, error)
- func (q *RBlockingQueue) PollWithTimeout(ctx context.Context, timeout time.Duration) (any, error)
- func (o RBlockingQueue) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o RBlockingQueue) Rename(ctx context.Context, newName string) error
- func (q *RBlockingQueue) Take(ctx context.Context) (any, error)
- func (o RBlockingQueue) Touch(ctx context.Context) (bool, error)
- func (o RBlockingQueue) Unlink(ctx context.Context) error
- type RBloomFilter
- func (f *RBloomFilter) Add(ctx context.Context, element any) (bool, error)
- func (f *RBloomFilter) AddAll(ctx context.Context, elements ...any) (int64, error)
- func (o *RBloomFilter) ClearExpire(ctx context.Context) (bool, error)
- func (f *RBloomFilter) Contains(ctx context.Context, element any) (bool, error)
- func (f *RBloomFilter) ContainsAll(ctx context.Context, elements ...any) (int64, error)
- func (f *RBloomFilter) Count(ctx context.Context) (int64, error)
- func (f *RBloomFilter) Delete(ctx context.Context) error
- func (o *RBloomFilter) Exists(ctx context.Context) (bool, error)
- func (f *RBloomFilter) ExpectedInsertions(ctx context.Context) (int64, error)
- func (o *RBloomFilter) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RBloomFilter) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (f *RBloomFilter) FalseProbability(ctx context.Context) (float64, error)
- func (f *RBloomFilter) HashIterations(ctx context.Context) (int64, error)
- func (o *RBloomFilter) Name() string
- func (o *RBloomFilter) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RBloomFilter) Rename(ctx context.Context, newName string) error
- func (f *RBloomFilter) Size(ctx context.Context) (int64, error)
- func (o *RBloomFilter) Touch(ctx context.Context) (bool, error)
- func (f *RBloomFilter) TryInit(ctx context.Context, expectedInsertions int64, falseProbability float64) (bool, error)
- func (o *RBloomFilter) Unlink(ctx context.Context) error
- type RBloomFilterNative
- func (f *RBloomFilterNative) Add(ctx context.Context, element any) (bool, error)
- func (f *RBloomFilterNative) AddAll(ctx context.Context, elements ...any) ([]bool, error)
- func (f *RBloomFilterNative) Card(ctx context.Context) (int64, error)
- func (o *RBloomFilterNative) ClearExpire(ctx context.Context) (bool, error)
- func (f *RBloomFilterNative) Contains(ctx context.Context, element any) (bool, error)
- func (f *RBloomFilterNative) ContainsAll(ctx context.Context, elements ...any) ([]bool, error)
- func (o *RBloomFilterNative) Delete(ctx context.Context) error
- func (o *RBloomFilterNative) Exists(ctx context.Context) (bool, error)
- func (o *RBloomFilterNative) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RBloomFilterNative) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o *RBloomFilterNative) Name() string
- func (o *RBloomFilterNative) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RBloomFilterNative) Rename(ctx context.Context, newName string) error
- func (o *RBloomFilterNative) Touch(ctx context.Context) (bool, error)
- func (f *RBloomFilterNative) TryInit(ctx context.Context, errorRate float64, capacity int64) (bool, error)
- func (o *RBloomFilterNative) Unlink(ctx context.Context) error
- type RBoundedBlockingQueue
- func (q *RBoundedBlockingQueue) Clear(ctx context.Context) error
- func (o RBoundedBlockingQueue) ClearExpire(ctx context.Context) (bool, error)
- func (q *RBoundedBlockingQueue) Delete(ctx context.Context) error
- func (o RBoundedBlockingQueue) Exists(ctx context.Context) (bool, error)
- func (o RBoundedBlockingQueue) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o RBoundedBlockingQueue) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o RBoundedBlockingQueue) Name() string
- func (q *RBoundedBlockingQueue) Offer(ctx context.Context, value any) (bool, error)
- func (q *RBoundedBlockingQueue) OfferWait(ctx context.Context, value any, wait time.Duration) (bool, error)
- func (q *RBoundedBlockingQueue) Poll(ctx context.Context) (any, error)
- func (q *RBoundedBlockingQueue) PollInto(ctx context.Context, target any) (bool, error)
- func (q *RBoundedBlockingQueue) Put(ctx context.Context, value any) error
- func (o RBoundedBlockingQueue) RemainTTL(ctx context.Context) (time.Duration, error)
- func (q *RBoundedBlockingQueue) RemainingCapacity(ctx context.Context) (int64, error)
- func (o RBoundedBlockingQueue) Rename(ctx context.Context, newName string) error
- func (q *RBoundedBlockingQueue) Take(ctx context.Context, timeout time.Duration) (any, error)
- func (o RBoundedBlockingQueue) Touch(ctx context.Context) (bool, error)
- func (q *RBoundedBlockingQueue) TrySetCapacity(ctx context.Context, capacity int64) (bool, error)
- func (o RBoundedBlockingQueue) Unlink(ctx context.Context) error
- type RBucket
- func (o *RBucket) ClearExpire(ctx context.Context) (bool, error)
- func (b *RBucket) CompareAndDelete(ctx context.Context, expect any) (bool, error)
- func (b *RBucket) CompareAndSet(ctx context.Context, expect, update any) (bool, error)
- func (o *RBucket) Delete(ctx context.Context) error
- func (o *RBucket) Exists(ctx context.Context) (bool, error)
- func (o *RBucket) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RBucket) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (b *RBucket) Get(ctx context.Context) (any, error)
- func (b *RBucket) GetAndDelete(ctx context.Context) (any, error)
- func (b *RBucket) GetAndSet(ctx context.Context, value any) (any, error)
- func (b *RBucket) GetAndSetWithTTL(ctx context.Context, value any, ttl time.Duration) (any, error)
- func (b *RBucket) GetInto(ctx context.Context, target any) (bool, error)
- func (o *RBucket) Name() string
- func (o *RBucket) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RBucket) Rename(ctx context.Context, newName string) error
- func (b *RBucket) Set(ctx context.Context, value any) error
- func (b *RBucket) SetAndKeepTTL(ctx context.Context, value any) error
- func (b *RBucket) SetIfExists(ctx context.Context, value any) (bool, error)
- func (b *RBucket) SetIfExistsWithTTL(ctx context.Context, value any, ttl time.Duration) (bool, error)
- func (b *RBucket) SetWithTTL(ctx context.Context, value any, ttl time.Duration) error
- func (b *RBucket) Size(ctx context.Context) (int64, error)
- func (o *RBucket) Touch(ctx context.Context) (bool, error)
- func (b *RBucket) TrySet(ctx context.Context, value any) (bool, error)
- func (b *RBucket) TrySetWithTTL(ctx context.Context, value any, ttl time.Duration) (bool, error)
- func (o *RBucket) Unlink(ctx context.Context) error
- type RBuckets
- func (b *RBuckets) Get(ctx context.Context, keys ...string) (map[string]any, error)
- func (b *RBuckets) Set(ctx context.Context, mapping map[string]any, ttl time.Duration) error
- func (b *RBuckets) SetIfAllKeysAbsent(ctx context.Context, mapping map[string]any) (bool, error)
- func (b *RBuckets) SetIfAllKeysExist(ctx context.Context, mapping map[string]any) (bool, error)
- func (b *RBuckets) TrySet(ctx context.Context, mapping map[string]any) (bool, error)
- type RCircularBuffer
- func (b *RCircularBuffer) Add(ctx context.Context, value any) error
- func (b *RCircularBuffer) AddAll(ctx context.Context, values ...any) error
- func (b *RCircularBuffer) Capacity(ctx context.Context) (int, error)
- func (b *RCircularBuffer) Clear(ctx context.Context) error
- func (o *RCircularBuffer) ClearExpire(ctx context.Context) (bool, error)
- func (o *RCircularBuffer) Delete(ctx context.Context) error
- func (o *RCircularBuffer) Exists(ctx context.Context) (bool, error)
- func (o *RCircularBuffer) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RCircularBuffer) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (b *RCircularBuffer) Get(ctx context.Context, index int64) (any, error)
- func (o *RCircularBuffer) Name() string
- func (b *RCircularBuffer) ReadAll(ctx context.Context) ([]any, error)
- func (o *RCircularBuffer) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RCircularBuffer) Rename(ctx context.Context, newName string) error
- func (b *RCircularBuffer) SetCapacity(ctx context.Context, capacity int) error
- func (b *RCircularBuffer) Size(ctx context.Context) (int64, error)
- func (o *RCircularBuffer) Touch(ctx context.Context) (bool, error)
- func (b *RCircularBuffer) TrySetCapacity(ctx context.Context, capacity int) (bool, error)
- func (o *RCircularBuffer) Unlink(ctx context.Context) error
- type RClientSideCaching
- func (csc *RClientSideCaching) Destroy() error
- func (csc *RClientSideCaching) Enabled() bool
- func (csc *RClientSideCaching) GetAtomicDouble(name string) *RAtomicDouble
- func (csc *RClientSideCaching) GetAtomicLong(name string) *RAtomicLong
- func (csc *RClientSideCaching) GetBitSet(name string) *RBitSet
- func (csc *RClientSideCaching) GetBlockingDeque(name string) *RBlockingDeque
- func (csc *RClientSideCaching) GetBlockingQueue(name string) *RBlockingQueue
- func (csc *RClientSideCaching) GetBucket(name string) *RBucket
- func (csc *RClientSideCaching) GetDeque(name string) *RDeque
- func (csc *RClientSideCaching) GetGeo(name string) *RGeo
- func (csc *RClientSideCaching) GetHyperLogLog(name string) *RHyperLogLog
- func (csc *RClientSideCaching) GetList(name string) *RList
- func (csc *RClientSideCaching) GetMap(name string) *RMap
- func (csc *RClientSideCaching) GetQueue(name string) *RQueue
- func (csc *RClientSideCaching) GetScoredSortedSet(name string) *RScoredSortedSet
- func (csc *RClientSideCaching) GetSet(name string) *RSet
- func (csc *RClientSideCaching) GetStream(name string) *RStream
- func (csc *RClientSideCaching) Owned() bool
- type RCountDownLatch
- func (l *RCountDownLatch) Await(ctx context.Context, timeout time.Duration) (bool, error)
- func (o *RCountDownLatch) ClearExpire(ctx context.Context) (bool, error)
- func (l *RCountDownLatch) CountDown(ctx context.Context) error
- func (o *RCountDownLatch) Delete(ctx context.Context) error
- func (o *RCountDownLatch) Exists(ctx context.Context) (bool, error)
- func (o *RCountDownLatch) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RCountDownLatch) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (l *RCountDownLatch) GetCount(ctx context.Context) (int64, error)
- func (o *RCountDownLatch) Name() string
- func (o *RCountDownLatch) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RCountDownLatch) Rename(ctx context.Context, newName string) error
- func (o *RCountDownLatch) Touch(ctx context.Context) (bool, error)
- func (l *RCountDownLatch) TrySetCount(ctx context.Context, count int64) (bool, error)
- func (o *RCountDownLatch) Unlink(ctx context.Context) error
- type RCuckooFilter
- func (f *RCuckooFilter) Add(ctx context.Context, element any) (bool, error)
- func (f *RCuckooFilter) AddIfAbsent(ctx context.Context, element any) (bool, error)
- func (o *RCuckooFilter) ClearExpire(ctx context.Context) (bool, error)
- func (f *RCuckooFilter) Contains(ctx context.Context, element any) (bool, error)
- func (f *RCuckooFilter) Count(ctx context.Context, element any) (int64, error)
- func (f *RCuckooFilter) Delete(ctx context.Context, element any) (bool, error)
- func (o *RCuckooFilter) Exists(ctx context.Context) (bool, error)
- func (o *RCuckooFilter) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RCuckooFilter) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o *RCuckooFilter) Name() string
- func (o *RCuckooFilter) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RCuckooFilter) Rename(ctx context.Context, newName string) error
- func (o *RCuckooFilter) Touch(ctx context.Context) (bool, error)
- func (f *RCuckooFilter) TryInit(ctx context.Context, capacity int64) (bool, error)
- func (o *RCuckooFilter) Unlink(ctx context.Context) error
- type RDelayedQueue
- func (q *RDelayedQueue) Clear(ctx context.Context) error
- func (o *RDelayedQueue) ClearExpire(ctx context.Context) (bool, error)
- func (q *RDelayedQueue) Contains(ctx context.Context, element any) (bool, error)
- func (q *RDelayedQueue) DelayedSize(ctx context.Context) (int64, error)
- func (q *RDelayedQueue) Delete(ctx context.Context) error
- func (o *RDelayedQueue) Exists(ctx context.Context) (bool, error)
- func (o *RDelayedQueue) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RDelayedQueue) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (q *RDelayedQueue) MigrateExpired(ctx context.Context) (int64, error)
- func (o *RDelayedQueue) Name() string
- func (q *RDelayedQueue) Offer(ctx context.Context, element any, delay time.Duration) error
- func (q *RDelayedQueue) Peek(ctx context.Context) (any, error)
- func (q *RDelayedQueue) Poll(ctx context.Context) (any, error)
- func (q *RDelayedQueue) ReadAll(ctx context.Context) ([]any, error)
- func (q *RDelayedQueue) ReadySize(ctx context.Context) (int64, error)
- func (o *RDelayedQueue) RemainTTL(ctx context.Context) (time.Duration, error)
- func (q *RDelayedQueue) Remove(ctx context.Context, element any) (bool, error)
- func (o *RDelayedQueue) Rename(ctx context.Context, newName string) error
- func (q *RDelayedQueue) Size(ctx context.Context) (int64, error)
- func (o *RDelayedQueue) Touch(ctx context.Context) (bool, error)
- func (o *RDelayedQueue) Unlink(ctx context.Context) error
- type RDeque
- func (d *RDeque) AddFirst(ctx context.Context, values ...any) error
- func (d *RDeque) AddFirstIfExists(ctx context.Context, values ...any) (int64, error)
- func (d *RDeque) AddLast(ctx context.Context, values ...any) error
- func (d *RDeque) AddLastIfExists(ctx context.Context, values ...any) (int64, error)
- func (d *RDeque) Clear(ctx context.Context) error
- func (o *RDeque) ClearExpire(ctx context.Context) (bool, error)
- func (o *RDeque) Delete(ctx context.Context) error
- func (o *RDeque) Exists(ctx context.Context) (bool, error)
- func (o *RDeque) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RDeque) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o *RDeque) Name() string
- func (d *RDeque) PeekFirst(ctx context.Context) (any, error)
- func (d *RDeque) PeekFirstInto(ctx context.Context, target any) (bool, error)
- func (d *RDeque) PeekLast(ctx context.Context) (any, error)
- func (d *RDeque) PeekLastInto(ctx context.Context, target any) (bool, error)
- func (d *RDeque) ReadAll(ctx context.Context) ([]any, error)
- func (o *RDeque) RemainTTL(ctx context.Context) (time.Duration, error)
- func (d *RDeque) RemoveFirst(ctx context.Context) (any, error)
- func (d *RDeque) RemoveFirstInto(ctx context.Context, target any) (bool, error)
- func (d *RDeque) RemoveLast(ctx context.Context) (any, error)
- func (d *RDeque) RemoveLastInto(ctx context.Context, target any) (bool, error)
- func (o *RDeque) Rename(ctx context.Context, newName string) error
- func (d *RDeque) Size(ctx context.Context) (int64, error)
- func (o *RDeque) Touch(ctx context.Context) (bool, error)
- func (o *RDeque) Unlink(ctx context.Context) error
- type RDoubleAdder
- type RFairLock
- func (o RFairLock) ClearExpire(ctx context.Context) (bool, error)
- func (o RFairLock) Delete(ctx context.Context) error
- func (o RFairLock) Exists(ctx context.Context) (bool, error)
- func (o RFairLock) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o RFairLock) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (l *RFairLock) ForceUnlock(ctx context.Context) (bool, error)
- func (l *RFairLock) HoldCount(ctx context.Context, clientID string) (int64, error)
- func (l *RFairLock) IsHeldBy(ctx context.Context, clientID string) (bool, error)
- func (l *RFairLock) IsLocked(ctx context.Context) (bool, error)
- func (l *RFairLock) Lock(ctx context.Context, clientID string, ttl time.Duration) error
- func (o RFairLock) Name() string
- func (o RFairLock) RemainTTL(ctx context.Context) (time.Duration, error)
- func (l *RFairLock) RemainTimeToLive(ctx context.Context) (time.Duration, error)
- func (o RFairLock) Rename(ctx context.Context, newName string) error
- func (o RFairLock) Touch(ctx context.Context) (bool, error)
- func (l *RFairLock) TryLock(ctx context.Context, clientID string, ttl time.Duration) (bool, error)
- func (l *RFairLock) TryLockWait(ctx context.Context, clientID string, wait, ttl time.Duration) (bool, error)
- func (o RFairLock) Unlink(ctx context.Context) error
- func (l *RFairLock) Unlock(ctx context.Context, clientID string) error
- type RFencedLock
- func (o RFencedLock) ClearExpire(ctx context.Context) (bool, error)
- func (o RFencedLock) Delete(ctx context.Context) error
- func (o RFencedLock) Exists(ctx context.Context) (bool, error)
- func (o RFencedLock) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o RFencedLock) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (l *RFencedLock) GetToken(ctx context.Context) (int64, error)
- func (l *RFencedLock) LockAndGetToken(ctx context.Context, clientID string, ttl time.Duration) (int64, error)
- func (o RFencedLock) Name() string
- func (o RFencedLock) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o RFencedLock) Rename(ctx context.Context, newName string) error
- func (o RFencedLock) Touch(ctx context.Context) (bool, error)
- func (l *RFencedLock) TryLockAndGetToken(ctx context.Context, clientID string, ttl time.Duration) (int64, error)
- func (o RFencedLock) Unlink(ctx context.Context) error
- type RFunction
- func (f *RFunction) Call(ctx context.Context, function string, keys []string, args ...any) (any, error)
- func (f *RFunction) CallReadOnly(ctx context.Context, function string, keys []string, args ...any) (any, error)
- func (f *RFunction) Delete(ctx context.Context, library string) error
- func (f *RFunction) Flush(ctx context.Context) error
- func (f *RFunction) List(ctx context.Context, withCode bool) ([]redis.Library, error)
- func (f *RFunction) Load(ctx context.Context, code string) error
- type RGcra
- func (o *RGcra) ClearExpire(ctx context.Context) (bool, error)
- func (o *RGcra) Delete(ctx context.Context) error
- func (o *RGcra) Exists(ctx context.Context) (bool, error)
- func (o *RGcra) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RGcra) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o *RGcra) Name() string
- func (o *RGcra) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RGcra) Rename(ctx context.Context, newName string) error
- func (o *RGcra) Touch(ctx context.Context) (bool, error)
- func (g *RGcra) TryAcquire(ctx context.Context, maxBurst, tokensPerPeriod int64, period time.Duration, ...) (*GcraResult, error)
- func (o *RGcra) Unlink(ctx context.Context) error
- type RGeo
- func (g *RGeo) Add(ctx context.Context, longitude, latitude float64, member any) (bool, error)
- func (g *RGeo) AddIfExists(ctx context.Context, longitude, latitude float64, member any) (bool, error)
- func (g *RGeo) AddMany(ctx context.Context, locations []GeoLocation) (int64, error)
- func (o *RGeo) ClearExpire(ctx context.Context) (bool, error)
- func (o *RGeo) Delete(ctx context.Context) error
- func (g *RGeo) Dist(ctx context.Context, member1, member2 any, unit string) (float64, error)
- func (o *RGeo) Exists(ctx context.Context) (bool, error)
- func (o *RGeo) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RGeo) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (g *RGeo) Hash(ctx context.Context, member any) (string, error)
- func (g *RGeo) HashMany(ctx context.Context, members ...any) ([]string, error)
- func (o *RGeo) Name() string
- func (g *RGeo) Pos(ctx context.Context, member any) ([]float64, error)
- func (g *RGeo) PosMany(ctx context.Context, members ...any) ([][]float64, error)
- func (o *RGeo) RemainTTL(ctx context.Context) (time.Duration, error)
- func (g *RGeo) Remove(ctx context.Context, member any) error
- func (o *RGeo) Rename(ctx context.Context, newName string) error
- func (g *RGeo) Search(ctx context.Context, longitude, latitude, radius float64, unit string, ...) ([]GeoEntry, error)
- func (g *RGeo) SearchByMember(ctx context.Context, member any, radius float64, unit string, ...) ([]GeoEntry, error)
- func (g *RGeo) Size(ctx context.Context) (int64, error)
- func (g *RGeo) StoreSearchTo(ctx context.Context, dest string, longitude, latitude, radius float64, ...) (int64, error)
- func (o *RGeo) Touch(ctx context.Context) (bool, error)
- func (g *RGeo) TryAdd(ctx context.Context, longitude, latitude float64, member any) (bool, error)
- func (o *RGeo) Unlink(ctx context.Context) error
- type RHyperLogLog
- func (h *RHyperLogLog) Add(ctx context.Context, element any) (bool, error)
- func (h *RHyperLogLog) AddAll(ctx context.Context, elements ...any) (bool, error)
- func (o *RHyperLogLog) ClearExpire(ctx context.Context) (bool, error)
- func (h *RHyperLogLog) Count(ctx context.Context) (int64, error)
- func (h *RHyperLogLog) CountWith(ctx context.Context, others ...string) (int64, error)
- func (o *RHyperLogLog) Delete(ctx context.Context) error
- func (o *RHyperLogLog) Exists(ctx context.Context) (bool, error)
- func (o *RHyperLogLog) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RHyperLogLog) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (h *RHyperLogLog) MergeInto(ctx context.Context, dest string, others ...string) error
- func (h *RHyperLogLog) MergeWith(ctx context.Context, others ...string) error
- func (o *RHyperLogLog) Name() string
- func (o *RHyperLogLog) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RHyperLogLog) Rename(ctx context.Context, newName string) error
- func (o *RHyperLogLog) Touch(ctx context.Context) (bool, error)
- func (o *RHyperLogLog) Unlink(ctx context.Context) error
- type RIdGenerator
- func (o *RIdGenerator) ClearExpire(ctx context.Context) (bool, error)
- func (g *RIdGenerator) Delete(ctx context.Context) error
- func (o *RIdGenerator) Exists(ctx context.Context) (bool, error)
- func (o *RIdGenerator) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RIdGenerator) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o *RIdGenerator) Name() string
- func (g *RIdGenerator) NextID(ctx context.Context) (int64, error)
- func (g *RIdGenerator) NextIDs(ctx context.Context, count int) ([]int64, error)
- func (o *RIdGenerator) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RIdGenerator) Rename(ctx context.Context, newName string) error
- func (o *RIdGenerator) Touch(ctx context.Context) (bool, error)
- func (g *RIdGenerator) TryInit(ctx context.Context, value, allocationSize int64) (bool, error)
- func (o *RIdGenerator) Unlink(ctx context.Context) error
- type RJsonBucket
- func (b *RJsonBucket) ArrayAppend(ctx context.Context, path string, values ...any) (int64, error)
- func (b *RJsonBucket) ArrayLen(ctx context.Context, path string) (int64, error)
- func (b *RJsonBucket) ArrayPop(ctx context.Context, path string, index int64) (any, error)
- func (o *RJsonBucket) ClearExpire(ctx context.Context) (bool, error)
- func (o *RJsonBucket) Delete(ctx context.Context) error
- func (b *RJsonBucket) DeletePath(ctx context.Context, path string) (int64, error)
- func (o *RJsonBucket) Exists(ctx context.Context) (bool, error)
- func (o *RJsonBucket) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RJsonBucket) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (b *RJsonBucket) Get(ctx context.Context) (any, error)
- func (b *RJsonBucket) GetPath(ctx context.Context, path string) (any, error)
- func (o *RJsonBucket) Name() string
- func (o *RJsonBucket) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RJsonBucket) Rename(ctx context.Context, newName string) error
- func (b *RJsonBucket) Set(ctx context.Context, value any) error
- func (b *RJsonBucket) SetPath(ctx context.Context, path string, value any) error
- func (b *RJsonBucket) SetPathNX(ctx context.Context, path string, value any) (bool, error)
- func (o *RJsonBucket) Touch(ctx context.Context) (bool, error)
- func (o *RJsonBucket) Unlink(ctx context.Context) error
- type RJsonBuckets
- type RKeys
- func (k *RKeys) ClearExpire(ctx context.Context, key string) (bool, error)
- func (k *RKeys) Copy(ctx context.Context, key, newKey string, replace bool) (bool, error)
- func (k *RKeys) Count(ctx context.Context) (int64, error)
- func (k *RKeys) CountExists(ctx context.Context, names ...string) (int64, error)
- func (k *RKeys) Delete(ctx context.Context, keys ...string) (int64, error)
- func (k *RKeys) DeleteByPattern(ctx context.Context, pattern string) (int64, error)
- func (k *RKeys) Expire(ctx context.Context, key string, ttl time.Duration) (bool, error)
- func (k *RKeys) ExpireAt(ctx context.Context, key string, at time.Time) (bool, error)
- func (k *RKeys) FlushAll(ctx context.Context) error
- func (k *RKeys) FlushDB(ctx context.Context) error
- func (k *RKeys) ForEachKey(ctx context.Context, pattern string, fn func(key string) error) error
- func (k *RKeys) Keys(ctx context.Context, pattern string) ([]string, error)
- func (k *RKeys) Migrate(ctx context.Context, key, host string, port, db int, timeout time.Duration) error
- func (k *RKeys) Move(ctx context.Context, key string, db int) (bool, error)
- func (k *RKeys) RandomKey(ctx context.Context) (string, error)
- func (k *RKeys) RemainTTL(ctx context.Context, key string) (time.Duration, error)
- func (k *RKeys) Rename(ctx context.Context, key, newKey string) error
- func (k *RKeys) RenameNX(ctx context.Context, key, newKey string) (bool, error)
- func (k *RKeys) SwapDB(ctx context.Context, db1, db2 int) error
- func (k *RKeys) Touch(ctx context.Context, keys ...string) (int64, error)
- func (k *RKeys) Type(ctx context.Context, key string) (string, error)
- func (k *RKeys) Unlink(ctx context.Context, keys ...string) (int64, error)
- func (k *RKeys) UnlinkByPattern(ctx context.Context, pattern string) (int64, error)
- type RLexSortedSet
- func (s *RLexSortedSet) Add(ctx context.Context, element string) (bool, error)
- func (s *RLexSortedSet) Clear(ctx context.Context) error
- func (o *RLexSortedSet) ClearExpire(ctx context.Context) (bool, error)
- func (s *RLexSortedSet) Contains(ctx context.Context, element string) (bool, error)
- func (s *RLexSortedSet) CountHead(ctx context.Context, toValue string) (int64, error)
- func (s *RLexSortedSet) CountRange(ctx context.Context, min, max string) (int64, error)
- func (s *RLexSortedSet) CountTail(ctx context.Context, fromValue string) (int64, error)
- func (o *RLexSortedSet) Delete(ctx context.Context) error
- func (o *RLexSortedSet) Exists(ctx context.Context) (bool, error)
- func (o *RLexSortedSet) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RLexSortedSet) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (s *RLexSortedSet) First(ctx context.Context) (string, error)
- func (s *RLexSortedSet) Last(ctx context.Context) (string, error)
- func (o *RLexSortedSet) Name() string
- func (s *RLexSortedSet) PollFirst(ctx context.Context) (string, error)
- func (s *RLexSortedSet) PollLast(ctx context.Context) (string, error)
- func (s *RLexSortedSet) Random(ctx context.Context) (string, error)
- func (s *RLexSortedSet) RandomN(ctx context.Context, count int) ([]string, error)
- func (s *RLexSortedSet) Range(ctx context.Context, start, stop int64) ([]string, error)
- func (s *RLexSortedSet) RangeByLex(ctx context.Context, min, max string, offset, count int64) ([]string, error)
- func (s *RLexSortedSet) RangeByLexReversed(ctx context.Context, min, max string, offset, count int64) ([]string, error)
- func (s *RLexSortedSet) RangeHead(ctx context.Context, toValue string, offset, count int64) ([]string, error)
- func (s *RLexSortedSet) RangeHeadReversed(ctx context.Context, toValue string, offset, count int64) ([]string, error)
- func (s *RLexSortedSet) RangeReversed(ctx context.Context, start, stop int64) ([]string, error)
- func (s *RLexSortedSet) RangeTail(ctx context.Context, fromValue string, offset, count int64) ([]string, error)
- func (s *RLexSortedSet) RangeTailReversed(ctx context.Context, fromValue string, offset, count int64) ([]string, error)
- func (s *RLexSortedSet) Rank(ctx context.Context, element string) (int64, error)
- func (o *RLexSortedSet) RemainTTL(ctx context.Context) (time.Duration, error)
- func (s *RLexSortedSet) Remove(ctx context.Context, element string) (bool, error)
- func (s *RLexSortedSet) RemoveRangeByLex(ctx context.Context, min, max string) (int64, error)
- func (s *RLexSortedSet) RemoveRangeHead(ctx context.Context, toValue string) (int64, error)
- func (s *RLexSortedSet) RemoveRangeTail(ctx context.Context, fromValue string) (int64, error)
- func (o *RLexSortedSet) Rename(ctx context.Context, newName string) error
- func (s *RLexSortedSet) RevRank(ctx context.Context, element string) (int64, error)
- func (s *RLexSortedSet) Size(ctx context.Context) (int64, error)
- func (o *RLexSortedSet) Touch(ctx context.Context) (bool, error)
- func (o *RLexSortedSet) Unlink(ctx context.Context) error
- type RList
- func (l *RList) Add(ctx context.Context, values ...any) error
- func (l *RList) AddAfter(ctx context.Context, pivot, element any) (int64, error)
- func (l *RList) AddBefore(ctx context.Context, pivot, element any) (int64, error)
- func (l *RList) AddCounted(ctx context.Context, values ...any) (int64, error)
- func (l *RList) Clear(ctx context.Context) error
- func (o *RList) ClearExpire(ctx context.Context) (bool, error)
- func (l *RList) Contains(ctx context.Context, value any) (bool, error)
- func (o *RList) Delete(ctx context.Context) error
- func (o *RList) Exists(ctx context.Context) (bool, error)
- func (o *RList) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RList) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (l *RList) FastRemoveByIndex(ctx context.Context, index int64) error
- func (l *RList) FastSet(ctx context.Context, index int64, value any) error
- func (l *RList) Get(ctx context.Context, index int64) (any, error)
- func (l *RList) GetInto(ctx context.Context, index int64, target any) (bool, error)
- func (l *RList) IndexOf(ctx context.Context, value any) (int64, error)
- func (l *RList) LastIndexOf(ctx context.Context, value any) (int64, error)
- func (o *RList) Name() string
- func (l *RList) Range(ctx context.Context, start, stop int64) ([]any, error)
- func (l *RList) ReadAll(ctx context.Context) ([]any, error)
- func (o *RList) RemainTTL(ctx context.Context) (time.Duration, error)
- func (l *RList) Remove(ctx context.Context, count int64, value any) error
- func (l *RList) RemoveByIndex(ctx context.Context, index int64) (any, error)
- func (l *RList) RemoveCounted(ctx context.Context, count int64, value any) (int64, error)
- func (o *RList) Rename(ctx context.Context, newName string) error
- func (l *RList) Set(ctx context.Context, index int64, value any) error
- func (l *RList) Size(ctx context.Context) (int64, error)
- func (o *RList) Touch(ctx context.Context) (bool, error)
- func (l *RList) Trim(ctx context.Context, start, stop int64) error
- func (o *RList) Unlink(ctx context.Context) error
- type RListMultimap
- func (o *RListMultimap) ClearExpire(ctx context.Context) (bool, error)
- func (o *RListMultimap) Delete(ctx context.Context) error
- func (o *RListMultimap) Exists(ctx context.Context) (bool, error)
- func (o *RListMultimap) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RListMultimap) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o *RListMultimap) Name() string
- func (o *RListMultimap) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RListMultimap) Rename(ctx context.Context, newName string) error
- func (o *RListMultimap) Touch(ctx context.Context) (bool, error)
- func (o *RListMultimap) Unlink(ctx context.Context) error
- type RListMultimapCache
- func (m RListMultimapCache) Clear(ctx context.Context) error
- func (m RListMultimapCache) ContainsEntry(ctx context.Context, key, value any) (bool, error)
- func (m RListMultimapCache) ContainsKey(ctx context.Context, key any) (bool, error)
- func (m RListMultimapCache) ContainsValue(ctx context.Context, value any) (bool, error)
- func (m RListMultimapCache) Delete(ctx context.Context) error
- func (m RListMultimapCache) Entries(ctx context.Context) ([]MultimapEntry, error)
- func (m RListMultimapCache) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (m RListMultimapCache) ExpireKey(ctx context.Context, key any, ttl time.Duration) (bool, error)
- func (m RListMultimapCache) Get(ctx context.Context, key any) ([]any, error)
- func (m RListMultimapCache) GetFairLock(key any) *RFairLock
- func (m RListMultimapCache) GetLock(key any) *RLock
- func (m RListMultimapCache) GetReadWriteLock(key any) *RReadWriteLock
- func (m RListMultimapCache) GetSemaphore(key any) *RSemaphore
- func (m RListMultimapCache) IsEmpty(ctx context.Context) (bool, error)
- func (m RListMultimapCache) KeySet(ctx context.Context) ([]any, error)
- func (m RListMultimapCache) KeySize(ctx context.Context) (int64, error)
- func (m RListMultimapCache) Put(ctx context.Context, key, value any) (bool, error)
- func (m RListMultimapCache) PutAll(ctx context.Context, key any, values ...any) (bool, error)
- func (m RListMultimapCache) ReadAllKeySet(ctx context.Context) ([]any, error)
- func (m RListMultimapCache) RemoveAll(ctx context.Context, key any) (bool, error)
- func (m RListMultimapCache) ReplaceValues(ctx context.Context, key any, values ...any) ([]any, error)
- func (m RListMultimapCache) Size(ctx context.Context) (int64, error)
- func (m RListMultimapCache) StartAutoEviction(interval time.Duration)
- func (m RListMultimapCache) Values(ctx context.Context) ([]any, error)
- type RListMultimapCacheNative
- func (o RListMultimapCacheNative) ClearExpire(ctx context.Context) (bool, error)
- func (o RListMultimapCacheNative) Delete(ctx context.Context) error
- func (o RListMultimapCacheNative) Exists(ctx context.Context) (bool, error)
- func (o RListMultimapCacheNative) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o RListMultimapCacheNative) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (m *RListMultimapCacheNative) ExpireKey(ctx context.Context, key any, ttl time.Duration) (bool, error)
- func (o RListMultimapCacheNative) Name() string
- func (o RListMultimapCacheNative) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o RListMultimapCacheNative) Rename(ctx context.Context, newName string) error
- func (o RListMultimapCacheNative) Touch(ctx context.Context) (bool, error)
- func (o RListMultimapCacheNative) Unlink(ctx context.Context) error
- type RLocalCachedMap
- func (m *RLocalCachedMap) CachedKeys() []string
- func (m *RLocalCachedMap) CachedValues() []any
- func (m *RLocalCachedMap) Clear(ctx context.Context) error
- func (o RLocalCachedMap) ClearExpire(ctx context.Context) (bool, error)
- func (m *RLocalCachedMap) ClearLocalCache()
- func (m *RLocalCachedMap) Destroy()
- func (o RLocalCachedMap) Exists(ctx context.Context) (bool, error)
- func (o RLocalCachedMap) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o RLocalCachedMap) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (m *RLocalCachedMap) FastPut(ctx context.Context, field string, value any) (bool, error)
- func (m *RLocalCachedMap) FastPutIfExists(ctx context.Context, field string, value any) (bool, error)
- func (m *RLocalCachedMap) FastRemove(ctx context.Context, fields ...string) (int64, error)
- func (m *RLocalCachedMap) FastReplace(ctx context.Context, field string, value any) (bool, error)
- func (m *RLocalCachedMap) Get(ctx context.Context, field string) (any, error)
- func (m *RLocalCachedMap) GetCachedMap() map[string]any
- func (m *RLocalCachedMap) GetInto(ctx context.Context, field string, target any) (bool, error)
- func (o RLocalCachedMap) Name() string
- func (m *RLocalCachedMap) PreloadCache(ctx context.Context, count ...int) error
- func (m *RLocalCachedMap) Put(ctx context.Context, field string, value any) error
- func (m *RLocalCachedMap) PutAll(ctx context.Context, entries map[string]any) error
- func (m *RLocalCachedMap) PutIfAbsent(ctx context.Context, field string, value any) (bool, error)
- func (o RLocalCachedMap) RemainTTL(ctx context.Context) (time.Duration, error)
- func (m *RLocalCachedMap) Remove(ctx context.Context, field string) error
- func (o RLocalCachedMap) Rename(ctx context.Context, newName string) error
- func (m *RLocalCachedMap) Replace(ctx context.Context, field string, value any) (any, error)
- func (m *RLocalCachedMap) ReplaceIf(ctx context.Context, field string, oldValue, newValue any) (bool, error)
- func (m *RLocalCachedMap) SetLocalCacheLimit(ttl time.Duration, maxEntries int)
- func (o RLocalCachedMap) Touch(ctx context.Context) (bool, error)
- func (o RLocalCachedMap) Unlink(ctx context.Context) error
- type RLock
- func (o *RLock) ClearExpire(ctx context.Context) (bool, error)
- func (o *RLock) Delete(ctx context.Context) error
- func (o *RLock) Exists(ctx context.Context) (bool, error)
- func (o *RLock) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RLock) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (l *RLock) ForceUnlock(ctx context.Context) (bool, error)
- func (l *RLock) HoldCount(ctx context.Context, clientID string) (int64, error)
- func (l *RLock) IsHeldBy(ctx context.Context, clientID string) (bool, error)
- func (l *RLock) IsLocked(ctx context.Context) (bool, error)
- func (l *RLock) Lock(ctx context.Context, clientID string, ttl time.Duration) error
- func (o *RLock) Name() string
- func (o *RLock) RemainTTL(ctx context.Context) (time.Duration, error)
- func (l *RLock) RemainTimeToLive(ctx context.Context) (time.Duration, error)
- func (o *RLock) Rename(ctx context.Context, newName string) error
- func (o *RLock) Touch(ctx context.Context) (bool, error)
- func (l *RLock) TryLock(ctx context.Context, clientID string, ttl time.Duration) (bool, error)
- func (l *RLock) TryLockWait(ctx context.Context, clientID string, wait, ttl time.Duration) (bool, error)
- func (o *RLock) Unlink(ctx context.Context) error
- func (l *RLock) Unlock(ctx context.Context, clientID string) error
- type RLongAdder
- type RMap
- func (m *RMap) AddAndGet(ctx context.Context, field string, delta int64) (int64, error)
- func (m *RMap) Clear(ctx context.Context) error
- func (o *RMap) ClearExpire(ctx context.Context) (bool, error)
- func (m *RMap) ContainsKey(ctx context.Context, field string) (bool, error)
- func (m *RMap) ContainsValue(ctx context.Context, value any) (bool, error)
- func (m *RMap) Delete(ctx context.Context, fields ...string) error
- func (o *RMap) Exists(ctx context.Context) (bool, error)
- func (o *RMap) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RMap) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (m *RMap) FastPut(ctx context.Context, field string, value any) (bool, error)
- func (m *RMap) FastPutIfAbsent(ctx context.Context, field string, value any) (bool, error)
- func (m *RMap) FastPutIfExists(ctx context.Context, field string, value any) (bool, error)
- func (m *RMap) FastRemove(ctx context.Context, fields ...string) (int64, error)
- func (m *RMap) FastReplace(ctx context.Context, field string, value any) (bool, error)
- func (m *RMap) Get(ctx context.Context, field string) (any, error)
- func (m *RMap) GetAll(ctx context.Context) (map[string]any, error)
- func (m *RMap) GetAllKeys(ctx context.Context, fields ...string) (map[string]any, error)
- func (m *RMap) GetCountDownLatch(key any) *RCountDownLatch
- func (m *RMap) GetFairLock(key any) *RFairLock
- func (m *RMap) GetInto(ctx context.Context, field string, target any) (bool, error)
- func (m *RMap) GetLock(key any) *RLock
- func (m *RMap) GetPermitExpirableSemaphore(key any) *RPermitExpirableSemaphore
- func (m *RMap) GetReadWriteLock(key any) *RReadWriteLock
- func (m *RMap) GetSemaphore(key any) *RSemaphore
- func (m *RMap) Keys(ctx context.Context) ([]string, error)
- func (o *RMap) Name() string
- func (m *RMap) Put(ctx context.Context, field string, value any) error
- func (m *RMap) PutAll(ctx context.Context, entries map[string]any) error
- func (m *RMap) PutIfAbsent(ctx context.Context, field string, value any) (bool, error)
- func (m *RMap) PutIfExists(ctx context.Context, field string, value any) (bool, error)
- func (m *RMap) RandomEntries(ctx context.Context, count int64) (map[string]any, error)
- func (m *RMap) RandomKeys(ctx context.Context, count int64) ([]string, error)
- func (o *RMap) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RMap) Rename(ctx context.Context, newName string) error
- func (m *RMap) Replace(ctx context.Context, field string, value any) (any, error)
- func (m *RMap) ReplaceIf(ctx context.Context, field string, oldValue, newValue any) (bool, error)
- func (m *RMap) Size(ctx context.Context) (int64, error)
- func (o *RMap) Touch(ctx context.Context) (bool, error)
- func (o *RMap) Unlink(ctx context.Context) error
- func (m *RMap) ValueSize(ctx context.Context, field string) (int64, error)
- func (m *RMap) Values(ctx context.Context) ([]any, error)
- type RMapCache
- func (m *RMapCache) AddListener(kind string, cb func(kind, key, value, oldValue any)) (int, error)
- func (m *RMapCache) Clear(ctx context.Context) error
- func (o RMapCache) ClearExpire(ctx context.Context) (bool, error)
- func (m *RMapCache) ContainsKey(ctx context.Context, field string) (bool, error)
- func (m *RMapCache) ContainsValue(ctx context.Context, value any) (bool, error)
- func (m *RMapCache) Delete(ctx context.Context, fields ...string) error
- func (m *RMapCache) EvictExpired(ctx context.Context) (int, error)
- func (o RMapCache) Exists(ctx context.Context) (bool, error)
- func (o RMapCache) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o RMapCache) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (m *RMapCache) ExpireEntries(ctx context.Context, fields []string, ttl, maxIdle time.Duration) (int, error)
- func (m *RMapCache) ExpireEntriesIfNotSet(ctx context.Context, fields []string, ttl, maxIdle time.Duration) (int, error)
- func (m *RMapCache) ExpireEntry(ctx context.Context, field string, ttl, maxIdle time.Duration) (bool, error)
- func (m *RMapCache) ExpireEntryIfNotSet(ctx context.Context, field string, ttl, maxIdle time.Duration) (bool, error)
- func (m *RMapCache) FastPut(ctx context.Context, field string, value any, durations ...time.Duration) (bool, error)
- func (m *RMapCache) FastPutIfAbsent(ctx context.Context, field string, value any, durations ...time.Duration) (bool, error)
- func (m *RMapCache) FastPutIfExists(ctx context.Context, field string, value any) (bool, error)
- func (m *RMapCache) FastRemove(ctx context.Context, fields ...string) (int64, error)
- func (m *RMapCache) FastReplace(ctx context.Context, field string, value any) (bool, error)
- func (m *RMapCache) Get(ctx context.Context, field string) (any, error)
- func (m *RMapCache) GetAll(ctx context.Context) (map[string]any, error)
- func (m *RMapCache) GetAllKeys(ctx context.Context, fields ...string) (map[string]any, error)
- func (m *RMapCache) GetAllWithTTLOnly(ctx context.Context, fields ...string) (map[string]any, error)
- func (m *RMapCache) GetInto(ctx context.Context, field string, target any) (bool, error)
- func (m *RMapCache) Keys(ctx context.Context) ([]string, error)
- func (o RMapCache) Name() string
- func (m *RMapCache) Put(ctx context.Context, field string, value any, durations ...time.Duration) error
- func (m *RMapCache) PutAll(ctx context.Context, entries map[string]any) error
- func (m *RMapCache) PutIfAbsent(ctx context.Context, field string, value any, durations ...time.Duration) (bool, error)
- func (m *RMapCache) PutIfExists(ctx context.Context, field string, value any) (bool, error)
- func (o RMapCache) RemainTTL(ctx context.Context) (time.Duration, error)
- func (m *RMapCache) RemainTTLForKey(ctx context.Context, field string) (time.Duration, error)
- func (m *RMapCache) Remove(ctx context.Context, field string) error
- func (m *RMapCache) RemoveListener(kind string, id int) bool
- func (o RMapCache) Rename(ctx context.Context, newName string) error
- func (m *RMapCache) Replace(ctx context.Context, field string, value any) (any, error)
- func (m *RMapCache) ReplaceIf(ctx context.Context, field string, oldValue, newValue any) (bool, error)
- func (m *RMapCache) SetMaxSize(ctx context.Context, size int) error
- func (m *RMapCache) SetMaxSizeMode(ctx context.Context, size int, mode EvictionMode) error
- func (m *RMapCache) Size(ctx context.Context) (int64, error)
- func (m *RMapCache) StartAutoEviction(interval time.Duration)
- func (o RMapCache) Touch(ctx context.Context) (bool, error)
- func (m *RMapCache) TrySetMaxSize(ctx context.Context, size int) (bool, error)
- func (m *RMapCache) TrySetMaxSizeMode(ctx context.Context, size int, mode EvictionMode) (bool, error)
- func (m *RMapCache) Unlink(ctx context.Context) error
- func (m *RMapCache) UpdateEntryExpiration(ctx context.Context, field string, ttl, maxIdle time.Duration) (bool, error)
- func (m *RMapCache) Values(ctx context.Context) ([]any, error)
- type RMapCacheNative
- func (o RMapCacheNative) ClearExpire(ctx context.Context) (bool, error)
- func (o RMapCacheNative) Exists(ctx context.Context) (bool, error)
- func (o RMapCacheNative) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o RMapCacheNative) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (m *RMapCacheNative) ExpireEntry(ctx context.Context, field string, ttl time.Duration) (bool, error)
- func (m *RMapCacheNative) ExpireEntryIfNotSet(ctx context.Context, field string, ttl time.Duration) (bool, error)
- func (m *RMapCacheNative) FastPutIfAbsentWithTTL(ctx context.Context, field string, value any, ttl time.Duration) (bool, error)
- func (m *RMapCacheNative) FastPutWithTTL(ctx context.Context, field string, value any, ttl time.Duration) (bool, error)
- func (o RMapCacheNative) Name() string
- func (m *RMapCacheNative) PutIfAbsentWithTTL(ctx context.Context, field string, value any, ttl time.Duration) (any, error)
- func (m *RMapCacheNative) PutUntil(ctx context.Context, field string, value any, at time.Time) (any, error)
- func (m *RMapCacheNative) PutWithTTL(ctx context.Context, field string, value any, ttl time.Duration) (any, error)
- func (o RMapCacheNative) RemainTTL(ctx context.Context) (time.Duration, error)
- func (m *RMapCacheNative) RemainTTLForKey(ctx context.Context, field string) (time.Duration, error)
- func (o RMapCacheNative) Rename(ctx context.Context, newName string) error
- func (o RMapCacheNative) Touch(ctx context.Context) (bool, error)
- func (o RMapCacheNative) Unlink(ctx context.Context) error
- type RMaps
- type RMultiLock
- type RMultimap
- func (m *RMultimap) Clear(ctx context.Context) error
- func (o *RMultimap) ClearExpire(ctx context.Context) (bool, error)
- func (m *RMultimap) ContainsEntry(ctx context.Context, key, value any) (bool, error)
- func (m *RMultimap) ContainsKey(ctx context.Context, key any) (bool, error)
- func (m *RMultimap) ContainsValue(ctx context.Context, value any) (bool, error)
- func (o *RMultimap) Delete(ctx context.Context) error
- func (m *RMultimap) Entries(ctx context.Context) ([]MultimapEntry, error)
- func (o *RMultimap) Exists(ctx context.Context) (bool, error)
- func (o *RMultimap) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RMultimap) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (m *RMultimap) FastRemove(ctx context.Context, keys ...any) (int64, error)
- func (m *RMultimap) FastRemoveValue(ctx context.Context, values ...any) (int64, error)
- func (m *RMultimap) FastReplaceValues(ctx context.Context, key any, values ...any) error
- func (m *RMultimap) Get(ctx context.Context, key any) ([]any, error)
- func (m *RMultimap) GetFairLock(key any) *RFairLock
- func (m *RMultimap) GetLock(key any) *RLock
- func (m *RMultimap) GetReadWriteLock(key any) *RReadWriteLock
- func (m *RMultimap) GetSemaphore(key any) *RSemaphore
- func (m *RMultimap) IsEmpty(ctx context.Context) (bool, error)
- func (m *RMultimap) KeySet(ctx context.Context) ([]any, error)
- func (m *RMultimap) KeySize(ctx context.Context) (int64, error)
- func (o *RMultimap) Name() string
- func (m *RMultimap) Put(ctx context.Context, key, value any) (bool, error)
- func (m *RMultimap) PutAll(ctx context.Context, key any, values ...any) (bool, error)
- func (m *RMultimap) ReadAllKeySet(ctx context.Context) ([]any, error)
- func (o *RMultimap) RemainTTL(ctx context.Context) (time.Duration, error)
- func (m *RMultimap) RemoveAll(ctx context.Context, key any) (bool, error)
- func (m *RMultimap) RemoveEntry(ctx context.Context, key, value any) (bool, error)
- func (o *RMultimap) Rename(ctx context.Context, newName string) error
- func (m *RMultimap) ReplaceValues(ctx context.Context, key any, values ...any) ([]any, error)
- func (m *RMultimap) Size(ctx context.Context) (int64, error)
- func (o *RMultimap) Touch(ctx context.Context) (bool, error)
- func (o *RMultimap) Unlink(ctx context.Context) error
- func (m *RMultimap) Values(ctx context.Context) ([]any, error)
- type RNonReentrantFairLock
- func (o RNonReentrantFairLock) ClearExpire(ctx context.Context) (bool, error)
- func (o RNonReentrantFairLock) Delete(ctx context.Context) error
- func (o RNonReentrantFairLock) Exists(ctx context.Context) (bool, error)
- func (o RNonReentrantFairLock) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o RNonReentrantFairLock) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o RNonReentrantFairLock) Name() string
- func (o RNonReentrantFairLock) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o RNonReentrantFairLock) Rename(ctx context.Context, newName string) error
- func (o RNonReentrantFairLock) Touch(ctx context.Context) (bool, error)
- func (o RNonReentrantFairLock) Unlink(ctx context.Context) error
- type RNonReentrantLock
- func (o *RNonReentrantLock) ClearExpire(ctx context.Context) (bool, error)
- func (o *RNonReentrantLock) Delete(ctx context.Context) error
- func (o *RNonReentrantLock) Exists(ctx context.Context) (bool, error)
- func (o *RNonReentrantLock) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RNonReentrantLock) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (l *RNonReentrantLock) ForceUnlock(ctx context.Context) (bool, error)
- func (l *RNonReentrantLock) IsHeldBy(ctx context.Context, clientID string) (bool, error)
- func (l *RNonReentrantLock) IsLocked(ctx context.Context) (bool, error)
- func (l *RNonReentrantLock) Lock(ctx context.Context, clientID string, ttl time.Duration) error
- func (o *RNonReentrantLock) Name() string
- func (o *RNonReentrantLock) RemainTTL(ctx context.Context) (time.Duration, error)
- func (l *RNonReentrantLock) RemainTimeToLive(ctx context.Context) (time.Duration, error)
- func (o *RNonReentrantLock) Rename(ctx context.Context, newName string) error
- func (o *RNonReentrantLock) Touch(ctx context.Context) (bool, error)
- func (l *RNonReentrantLock) TryLock(ctx context.Context, clientID string, ttl time.Duration) (bool, error)
- func (l *RNonReentrantLock) TryLockWait(ctx context.Context, clientID string, wait, ttl time.Duration) (bool, error)
- func (o *RNonReentrantLock) Unlink(ctx context.Context) error
- func (l *RNonReentrantLock) Unlock(ctx context.Context, clientID string) error
- type RPatternTopic
- func (o *RPatternTopic) ClearExpire(ctx context.Context) (bool, error)
- func (t *RPatternTopic) CountListeners() int
- func (o *RPatternTopic) Delete(ctx context.Context) error
- func (o *RPatternTopic) Exists(ctx context.Context) (bool, error)
- func (o *RPatternTopic) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RPatternTopic) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o *RPatternTopic) Name() string
- func (o *RPatternTopic) RemainTTL(ctx context.Context) (time.Duration, error)
- func (t *RPatternTopic) RemoveAllListeners()
- func (o *RPatternTopic) Rename(ctx context.Context, newName string) error
- func (t *RPatternTopic) Subscribe(listener func(channel string, msg any)) (int, error)
- func (o *RPatternTopic) Touch(ctx context.Context) (bool, error)
- func (o *RPatternTopic) Unlink(ctx context.Context) error
- func (t *RPatternTopic) Unsubscribe(id int) bool
- type RPermitExpirableSemaphore
- func (s *RPermitExpirableSemaphore) Acquire(ctx context.Context, lease time.Duration) (string, error)
- func (s *RPermitExpirableSemaphore) AcquireN(ctx context.Context, permits int, lease time.Duration) ([]string, error)
- func (s *RPermitExpirableSemaphore) AcquiredPermits(ctx context.Context) (int64, error)
- func (s *RPermitExpirableSemaphore) AddPermits(ctx context.Context, permits int64) error
- func (s *RPermitExpirableSemaphore) AvailablePermits(ctx context.Context) (int64, error)
- func (o *RPermitExpirableSemaphore) ClearExpire(ctx context.Context) (bool, error)
- func (s *RPermitExpirableSemaphore) Delete(ctx context.Context) error
- func (o *RPermitExpirableSemaphore) Exists(ctx context.Context) (bool, error)
- func (o *RPermitExpirableSemaphore) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RPermitExpirableSemaphore) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (s *RPermitExpirableSemaphore) GetPermits(ctx context.Context) (int64, error)
- func (s *RPermitExpirableSemaphore) LeaseTime(ctx context.Context, permitID string) (time.Duration, error)
- func (o *RPermitExpirableSemaphore) Name() string
- func (s *RPermitExpirableSemaphore) Release(ctx context.Context, permitID string) (bool, error)
- func (s *RPermitExpirableSemaphore) ReleaseAll(ctx context.Context, permitIDs ...string) (int64, error)
- func (o *RPermitExpirableSemaphore) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RPermitExpirableSemaphore) Rename(ctx context.Context, newName string) error
- func (s *RPermitExpirableSemaphore) SetPermits(ctx context.Context, permits int64) error
- func (o *RPermitExpirableSemaphore) Touch(ctx context.Context) (bool, error)
- func (s *RPermitExpirableSemaphore) TryAcquire(ctx context.Context, lease time.Duration) (string, error)
- func (s *RPermitExpirableSemaphore) TryAcquireN(ctx context.Context, permits int, lease time.Duration) ([]string, error)
- func (s *RPermitExpirableSemaphore) TryAcquireWait(ctx context.Context, lease, wait time.Duration) (string, error)
- func (s *RPermitExpirableSemaphore) TrySetPermits(ctx context.Context, permits int64) (bool, error)
- func (o *RPermitExpirableSemaphore) Unlink(ctx context.Context) error
- func (s *RPermitExpirableSemaphore) UpdateLeaseTime(ctx context.Context, permitID string, lease time.Duration) (bool, error)
- type RPriorityBlockingDeque
- func (o RPriorityBlockingDeque) ClearExpire(ctx context.Context) (bool, error)
- func (o RPriorityBlockingDeque) Delete(ctx context.Context) error
- func (o RPriorityBlockingDeque) Exists(ctx context.Context) (bool, error)
- func (o RPriorityBlockingDeque) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o RPriorityBlockingDeque) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o RPriorityBlockingDeque) Name() string
- func (q *RPriorityBlockingDeque) PollLastWithTimeout(ctx context.Context, timeout time.Duration) (any, error)
- func (o RPriorityBlockingDeque) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o RPriorityBlockingDeque) Rename(ctx context.Context, newName string) error
- func (q *RPriorityBlockingDeque) TakeLast(ctx context.Context) (any, error)
- func (o RPriorityBlockingDeque) Touch(ctx context.Context) (bool, error)
- func (o RPriorityBlockingDeque) Unlink(ctx context.Context) error
- type RPriorityBlockingQueue
- func (o RPriorityBlockingQueue) ClearExpire(ctx context.Context) (bool, error)
- func (o RPriorityBlockingQueue) Delete(ctx context.Context) error
- func (o RPriorityBlockingQueue) Exists(ctx context.Context) (bool, error)
- func (o RPriorityBlockingQueue) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o RPriorityBlockingQueue) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o RPriorityBlockingQueue) Name() string
- func (q *RPriorityBlockingQueue) PollWithTimeout(ctx context.Context, timeout time.Duration) (any, error)
- func (o RPriorityBlockingQueue) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o RPriorityBlockingQueue) Rename(ctx context.Context, newName string) error
- func (q *RPriorityBlockingQueue) Take(ctx context.Context) (any, error)
- func (o RPriorityBlockingQueue) Touch(ctx context.Context) (bool, error)
- func (o RPriorityBlockingQueue) Unlink(ctx context.Context) error
- type RPriorityDeque
- func (o RPriorityDeque) ClearExpire(ctx context.Context) (bool, error)
- func (o RPriorityDeque) Delete(ctx context.Context) error
- func (o RPriorityDeque) Exists(ctx context.Context) (bool, error)
- func (o RPriorityDeque) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o RPriorityDeque) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o RPriorityDeque) Name() string
- func (q *RPriorityDeque) PeekFirst(ctx context.Context) (any, error)
- func (q *RPriorityDeque) PeekLast(ctx context.Context) (any, error)
- func (q *RPriorityDeque) PollFirst(ctx context.Context) (any, error)
- func (q *RPriorityDeque) PollLast(ctx context.Context) (any, error)
- func (o RPriorityDeque) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o RPriorityDeque) Rename(ctx context.Context, newName string) error
- func (o RPriorityDeque) Touch(ctx context.Context) (bool, error)
- func (o RPriorityDeque) Unlink(ctx context.Context) error
- type RPriorityQueue
- func (q *RPriorityQueue) Clear(ctx context.Context) error
- func (o *RPriorityQueue) ClearExpire(ctx context.Context) (bool, error)
- func (o *RPriorityQueue) Delete(ctx context.Context) error
- func (o *RPriorityQueue) Exists(ctx context.Context) (bool, error)
- func (o *RPriorityQueue) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RPriorityQueue) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o *RPriorityQueue) Name() string
- func (q *RPriorityQueue) Offer(ctx context.Context, element any, score float64) error
- func (q *RPriorityQueue) Peek(ctx context.Context) (any, error)
- func (q *RPriorityQueue) PeekScore(ctx context.Context, element any) (float64, bool, error)
- func (q *RPriorityQueue) Poll(ctx context.Context) (any, error)
- func (o *RPriorityQueue) RemainTTL(ctx context.Context) (time.Duration, error)
- func (q *RPriorityQueue) Remove(ctx context.Context, element any) error
- func (o *RPriorityQueue) Rename(ctx context.Context, newName string) error
- func (q *RPriorityQueue) Size(ctx context.Context) (int64, error)
- func (o *RPriorityQueue) Touch(ctx context.Context) (bool, error)
- func (o *RPriorityQueue) Unlink(ctx context.Context) error
- type RQueue
- func (q *RQueue) Clear(ctx context.Context) error
- func (o *RQueue) ClearExpire(ctx context.Context) (bool, error)
- func (o *RQueue) Delete(ctx context.Context) error
- func (o *RQueue) Exists(ctx context.Context) (bool, error)
- func (o *RQueue) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RQueue) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o *RQueue) Name() string
- func (q *RQueue) Offer(ctx context.Context, values ...any) error
- func (q *RQueue) Peek(ctx context.Context) (any, error)
- func (q *RQueue) PeekInto(ctx context.Context, target any) (bool, error)
- func (q *RQueue) Poll(ctx context.Context) (any, error)
- func (q *RQueue) PollInto(ctx context.Context, target any) (bool, error)
- func (q *RQueue) ReadAll(ctx context.Context) ([]any, error)
- func (o *RQueue) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RQueue) Rename(ctx context.Context, newName string) error
- func (q *RQueue) Size(ctx context.Context) (int64, error)
- func (q *RQueue) Take(ctx context.Context, timeout time.Duration) (any, error)
- func (o *RQueue) Touch(ctx context.Context) (bool, error)
- func (o *RQueue) Unlink(ctx context.Context) error
- type RRateLimiter
- func (r *RRateLimiter) Acquire(ctx context.Context, permits int64) error
- func (r *RRateLimiter) AvailablePermits(ctx context.Context) (int64, error)
- func (o *RRateLimiter) ClearExpire(ctx context.Context) (bool, error)
- func (r *RRateLimiter) Delete(ctx context.Context) error
- func (o *RRateLimiter) Exists(ctx context.Context) (bool, error)
- func (o *RRateLimiter) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RRateLimiter) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (r *RRateLimiter) GetConfig(ctx context.Context) (RateLimiterConfig, error)
- func (o *RRateLimiter) Name() string
- func (r *RRateLimiter) Release(ctx context.Context, permits int64) error
- func (o *RRateLimiter) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RRateLimiter) Rename(ctx context.Context, newName string) error
- func (r *RRateLimiter) SetRate(ctx context.Context, rateType RateType, rate int64, interval time.Duration) error
- func (r *RRateLimiter) SetRateWithKeepAlive(ctx context.Context, rateType RateType, rate int64, ...) error
- func (o *RRateLimiter) Touch(ctx context.Context) (bool, error)
- func (r *RRateLimiter) TryAcquire(ctx context.Context, permits int64) (bool, error)
- func (r *RRateLimiter) TryAcquireWait(ctx context.Context, permits int64, wait time.Duration) (bool, error)
- func (r *RRateLimiter) TrySetRate(ctx context.Context, rateType RateType, rate int64, interval time.Duration) (bool, error)
- func (r *RRateLimiter) TrySetRateWithKeepAlive(ctx context.Context, rateType RateType, rate int64, ...) (bool, error)
- func (o *RRateLimiter) Unlink(ctx context.Context) error
- func (r *RRateLimiter) UpdateRate(ctx context.Context, rateType RateType, rate int64, interval time.Duration) (bool, error)
- func (r *RRateLimiter) UpdateRateWithKeepAlive(ctx context.Context, rateType RateType, rate int64, ...) (bool, error)
- type RReadWriteLock
- type RReadWriteSubLock
- func (o *RReadWriteSubLock) ClearExpire(ctx context.Context) (bool, error)
- func (o *RReadWriteSubLock) Delete(ctx context.Context) error
- func (o *RReadWriteSubLock) Exists(ctx context.Context) (bool, error)
- func (o *RReadWriteSubLock) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RReadWriteSubLock) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (s *RReadWriteSubLock) ForceUnlock(ctx context.Context) (bool, error)
- func (s *RReadWriteSubLock) HoldCount(ctx context.Context, clientID string) (int64, error)
- func (s *RReadWriteSubLock) IsHeldBy(ctx context.Context, clientID string) (bool, error)
- func (s *RReadWriteSubLock) IsLocked(ctx context.Context) (bool, error)
- func (s *RReadWriteSubLock) Lock(ctx context.Context, clientID string, ttl time.Duration) error
- func (o *RReadWriteSubLock) Name() string
- func (o *RReadWriteSubLock) RemainTTL(ctx context.Context) (time.Duration, error)
- func (s *RReadWriteSubLock) RemainTimeToLive(ctx context.Context) (time.Duration, error)
- func (o *RReadWriteSubLock) Rename(ctx context.Context, newName string) error
- func (o *RReadWriteSubLock) Touch(ctx context.Context) (bool, error)
- func (s *RReadWriteSubLock) TryLock(ctx context.Context, clientID string, ttl time.Duration) (bool, error)
- func (s *RReadWriteSubLock) TryLockWait(ctx context.Context, clientID string, wait, ttl time.Duration) (bool, error)
- func (o *RReadWriteSubLock) Unlink(ctx context.Context) error
- func (s *RReadWriteSubLock) Unlock(ctx context.Context, clientID string) error
- type RRedLock
- func (r *RRedLock) Lock(ctx context.Context, clientID string, ttl, wait time.Duration) error
- func (r *RRedLock) TryLock(ctx context.Context, clientID string, ttl time.Duration) (bool, error)
- func (r *RRedLock) TryLockWait(ctx context.Context, clientID string, wait, ttl time.Duration) (bool, error)
- func (r *RRedLock) Unlock(ctx context.Context, clientID string) error
- type RRedisNodes
- type RReliableTopic
- func (o *RReliableTopic) ClearExpire(ctx context.Context) (bool, error)
- func (t *RReliableTopic) CountListeners() int
- func (t *RReliableTopic) CountSubscribers(ctx context.Context) (int64, error)
- func (t *RReliableTopic) Delete(ctx context.Context) error
- func (o *RReliableTopic) Exists(ctx context.Context) (bool, error)
- func (o *RReliableTopic) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RReliableTopic) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o *RReliableTopic) Name() string
- func (t *RReliableTopic) Publish(ctx context.Context, message any) (int64, error)
- func (o *RReliableTopic) RemainTTL(ctx context.Context) (time.Duration, error)
- func (t *RReliableTopic) RemoveAllListeners()
- func (o *RReliableTopic) Rename(ctx context.Context, newName string) error
- func (t *RReliableTopic) Size(ctx context.Context) (int64, error)
- func (t *RReliableTopic) Subscribe(listener func(msg any)) (string, error)
- func (o *RReliableTopic) Touch(ctx context.Context) (bool, error)
- func (o *RReliableTopic) Unlink(ctx context.Context) error
- func (t *RReliableTopic) Unsubscribe(id string)
- type RRingBuffer
- func (r *RRingBuffer) Add(ctx context.Context, value any) error
- func (r *RRingBuffer) AddAll(ctx context.Context, values ...any) error
- func (r *RRingBuffer) Capacity(ctx context.Context) (int64, error)
- func (r *RRingBuffer) Clear(ctx context.Context) error
- func (o *RRingBuffer) ClearExpire(ctx context.Context) (bool, error)
- func (r *RRingBuffer) Delete(ctx context.Context) error
- func (o *RRingBuffer) Exists(ctx context.Context) (bool, error)
- func (o *RRingBuffer) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RRingBuffer) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o *RRingBuffer) Name() string
- func (r *RRingBuffer) Offer(ctx context.Context, value any) error
- func (r *RRingBuffer) Peek(ctx context.Context) (any, error)
- func (r *RRingBuffer) Poll(ctx context.Context) (any, error)
- func (r *RRingBuffer) ReadAll(ctx context.Context) ([]any, error)
- func (r *RRingBuffer) ReadNewest(ctx context.Context, count int64) ([]any, error)
- func (r *RRingBuffer) ReadOldest(ctx context.Context, count int64) ([]any, error)
- func (o *RRingBuffer) RemainTTL(ctx context.Context) (time.Duration, error)
- func (r *RRingBuffer) RemainingCapacity(ctx context.Context) (int64, error)
- func (o *RRingBuffer) Rename(ctx context.Context, newName string) error
- func (r *RRingBuffer) SetCapacity(ctx context.Context, capacity int64) error
- func (r *RRingBuffer) Size(ctx context.Context) (int64, error)
- func (o *RRingBuffer) Touch(ctx context.Context) (bool, error)
- func (r *RRingBuffer) TrySetCapacity(ctx context.Context, capacity int64) (bool, error)
- func (o *RRingBuffer) Unlink(ctx context.Context) error
- type RScoredSortedSet
- func (s *RScoredSortedSet) Add(ctx context.Context, member any, score float64) (bool, error)
- func (s *RScoredSortedSet) AddAllIfAbsent(ctx context.Context, entries map[any]float64) (int64, error)
- func (s *RScoredSortedSet) AddAndGetRank(ctx context.Context, member any, score float64) (int64, error)
- func (s *RScoredSortedSet) AddIfAbsent(ctx context.Context, member any, score float64) (bool, error)
- func (s *RScoredSortedSet) AddIfExists(ctx context.Context, member any, score float64) (bool, error)
- func (s *RScoredSortedSet) AddIfGreater(ctx context.Context, member any, score float64) (bool, error)
- func (s *RScoredSortedSet) AddIfLess(ctx context.Context, member any, score float64) (bool, error)
- func (s *RScoredSortedSet) AddScore(ctx context.Context, member any, delta float64) (float64, error)
- func (s *RScoredSortedSet) AddScoreAndGetRank(ctx context.Context, member any, delta float64) (int64, error)
- func (s *RScoredSortedSet) Clear(ctx context.Context) error
- func (o *RScoredSortedSet) ClearExpire(ctx context.Context) (bool, error)
- func (s *RScoredSortedSet) Contains(ctx context.Context, member any) (bool, error)
- func (s *RScoredSortedSet) Count(ctx context.Context, min, max float64) (int64, error)
- func (o *RScoredSortedSet) Delete(ctx context.Context) error
- func (s *RScoredSortedSet) Diff(ctx context.Context, otherNames ...string) ([]any, error)
- func (s *RScoredSortedSet) DiffStore(ctx context.Context, dest string, otherNames ...string) (int64, error)
- func (s *RScoredSortedSet) EntryRange(ctx context.Context, start, stop int64) ([]redis.Z, error)
- func (o *RScoredSortedSet) Exists(ctx context.Context) (bool, error)
- func (o *RScoredSortedSet) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RScoredSortedSet) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (s *RScoredSortedSet) First(ctx context.Context) (any, error)
- func (s *RScoredSortedSet) FirstEntry(ctx context.Context) (*redis.Z, error)
- func (s *RScoredSortedSet) FirstScore(ctx context.Context) (float64, error)
- func (s *RScoredSortedSet) Intersection(ctx context.Context, otherNames ...string) ([]any, error)
- func (s *RScoredSortedSet) IntersectionStore(ctx context.Context, dest string, otherNames ...string) (int64, error)
- func (s *RScoredSortedSet) Last(ctx context.Context) (any, error)
- func (s *RScoredSortedSet) LastEntry(ctx context.Context) (*redis.Z, error)
- func (s *RScoredSortedSet) LastScore(ctx context.Context) (float64, error)
- func (o *RScoredSortedSet) Name() string
- func (s *RScoredSortedSet) PollFirst(ctx context.Context) (any, error)
- func (s *RScoredSortedSet) PollFirstEntries(ctx context.Context, count int64) ([]redis.Z, error)
- func (s *RScoredSortedSet) PollLast(ctx context.Context) (any, error)
- func (s *RScoredSortedSet) PollLastEntries(ctx context.Context, count int64) ([]redis.Z, error)
- func (s *RScoredSortedSet) Random(ctx context.Context) (any, error)
- func (s *RScoredSortedSet) RandomN(ctx context.Context, count int64) ([]any, error)
- func (s *RScoredSortedSet) Range(ctx context.Context, start, stop int64) ([]any, error)
- func (s *RScoredSortedSet) RangeByScore(ctx context.Context, min, max float64) ([]any, error)
- func (s *RScoredSortedSet) RangeReversed(ctx context.Context, start, stop int64) ([]any, error)
- func (s *RScoredSortedSet) RangeWithScores(ctx context.Context, start, stop int64) ([]redis.Z, error)
- func (s *RScoredSortedSet) Rank(ctx context.Context, member any) (int64, error)
- func (o *RScoredSortedSet) RemainTTL(ctx context.Context) (time.Duration, error)
- func (s *RScoredSortedSet) Remove(ctx context.Context, members ...any) error
- func (s *RScoredSortedSet) RemoveRangeByRank(ctx context.Context, start, stop int64) (int64, error)
- func (s *RScoredSortedSet) RemoveRangeByScore(ctx context.Context, min, max float64) (int64, error)
- func (o *RScoredSortedSet) Rename(ctx context.Context, newName string) error
- func (s *RScoredSortedSet) RevRank(ctx context.Context, member any) (int64, error)
- func (s *RScoredSortedSet) Score(ctx context.Context, member any) (float64, error)
- func (s *RScoredSortedSet) Size(ctx context.Context) (int64, error)
- func (o *RScoredSortedSet) Touch(ctx context.Context) (bool, error)
- func (s *RScoredSortedSet) TryAdd(ctx context.Context, member any, score float64) (bool, error)
- func (s *RScoredSortedSet) Union(ctx context.Context, otherNames ...string) ([]any, error)
- func (s *RScoredSortedSet) UnionStore(ctx context.Context, dest string, otherNames ...string) (int64, error)
- func (o *RScoredSortedSet) Unlink(ctx context.Context) error
- type RScript
- func (s *RScript) Eval(ctx context.Context, script string, rt ScriptReturnType, keys []string, ...) (any, error)
- func (s *RScript) EvalSha(ctx context.Context, sha string, rt ScriptReturnType, keys []string, ...) (any, error)
- func (s *RScript) ScriptExists(ctx context.Context, shas ...string) ([]bool, error)
- func (s *RScript) ScriptLoad(ctx context.Context, script string) (string, error)
- type RSearch
- func (s *RSearch) CreateIndex(ctx context.Context, name string, opts IndexOptions, fields ...IndexField) error
- func (s *RSearch) DropIndex(ctx context.Context, name string, deleteDocuments bool) error
- func (s *RSearch) Search(ctx context.Context, name, query string, opts SearchOptions) (SearchResult, error)
- type RSemaphore
- func (s *RSemaphore) Acquire(ctx context.Context, permits int64) error
- func (s *RSemaphore) AddPermits(ctx context.Context, permits int64) error
- func (s *RSemaphore) AvailablePermits(ctx context.Context) (int64, error)
- func (o *RSemaphore) ClearExpire(ctx context.Context) (bool, error)
- func (o *RSemaphore) Delete(ctx context.Context) error
- func (s *RSemaphore) DrainPermits(ctx context.Context) (int64, error)
- func (o *RSemaphore) Exists(ctx context.Context) (bool, error)
- func (o *RSemaphore) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RSemaphore) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o *RSemaphore) Name() string
- func (s *RSemaphore) Release(ctx context.Context, permits int64) error
- func (s *RSemaphore) ReleaseIfExists(ctx context.Context, permits int64) (bool, error)
- func (o *RSemaphore) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RSemaphore) Rename(ctx context.Context, newName string) error
- func (o *RSemaphore) Touch(ctx context.Context) (bool, error)
- func (s *RSemaphore) TryAcquire(ctx context.Context, permits int64) (bool, error)
- func (s *RSemaphore) TryAcquireWait(ctx context.Context, permits int64, wait time.Duration) (bool, error)
- func (s *RSemaphore) TrySetPermits(ctx context.Context, permits int64) (bool, error)
- func (o *RSemaphore) Unlink(ctx context.Context) error
- type RSet
- func (s *RSet) Add(ctx context.Context, members ...any) error
- func (s *RSet) AddCounted(ctx context.Context, members ...any) (int64, error)
- func (s *RSet) Clear(ctx context.Context) error
- func (o *RSet) ClearExpire(ctx context.Context) (bool, error)
- func (s *RSet) Contains(ctx context.Context, member any) (bool, error)
- func (s *RSet) CountIntersection(ctx context.Context, otherNames ...string) (int64, error)
- func (o *RSet) Delete(ctx context.Context) error
- func (s *RSet) Diff(ctx context.Context, otherNames ...string) ([]any, error)
- func (s *RSet) DiffStore(ctx context.Context, dest string, otherNames ...string) (int64, error)
- func (o *RSet) Exists(ctx context.Context) (bool, error)
- func (o *RSet) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RSet) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (s *RSet) GetCountDownLatch(value any) *RCountDownLatch
- func (s *RSet) GetFairLock(value any) *RFairLock
- func (s *RSet) GetLock(value any) *RLock
- func (s *RSet) GetPermitExpirableSemaphore(value any) *RPermitExpirableSemaphore
- func (s *RSet) GetReadWriteLock(value any) *RReadWriteLock
- func (s *RSet) GetSemaphore(value any) *RSemaphore
- func (s *RSet) Intersection(ctx context.Context, otherNames ...string) ([]any, error)
- func (s *RSet) IntersectionStore(ctx context.Context, dest string, otherNames ...string) (int64, error)
- func (s *RSet) Members(ctx context.Context) ([]any, error)
- func (s *RSet) Move(ctx context.Context, destination string, member any) (bool, error)
- func (o *RSet) Name() string
- func (s *RSet) Random(ctx context.Context) (any, error)
- func (s *RSet) RandomN(ctx context.Context, n int64) ([]any, error)
- func (s *RSet) ReadAll(ctx context.Context) ([]any, error)
- func (o *RSet) RemainTTL(ctx context.Context) (time.Duration, error)
- func (s *RSet) Remove(ctx context.Context, members ...any) error
- func (s *RSet) RemoveCounted(ctx context.Context, members ...any) (int64, error)
- func (s *RSet) RemoveRandom(ctx context.Context) (any, error)
- func (s *RSet) RemoveRandomN(ctx context.Context, n int64) ([]any, error)
- func (o *RSet) Rename(ctx context.Context, newName string) error
- func (s *RSet) Size(ctx context.Context) (int64, error)
- func (o *RSet) Touch(ctx context.Context) (bool, error)
- func (s *RSet) TryAdd(ctx context.Context, members ...any) (bool, error)
- func (s *RSet) Union(ctx context.Context, otherNames ...string) ([]any, error)
- func (s *RSet) UnionStore(ctx context.Context, dest string, otherNames ...string) (int64, error)
- func (o *RSet) Unlink(ctx context.Context) error
- type RSetCache
- func (s *RSetCache) Add(ctx context.Context, element any, ttl, maxIdle time.Duration) (bool, error)
- func (s *RSetCache) AddIfAbsent(ctx context.Context, element any, ttl time.Duration) (bool, error)
- func (s *RSetCache) AddIfExists(ctx context.Context, element any, ttl time.Duration) (bool, error)
- func (s *RSetCache) AddIfGreater(ctx context.Context, element any, ttl time.Duration) (bool, error)
- func (s *RSetCache) AddIfLess(ctx context.Context, element any, ttl time.Duration) (bool, error)
- func (s *RSetCache) Clear(ctx context.Context) error
- func (o *RSetCache) ClearExpire(ctx context.Context) (bool, error)
- func (s *RSetCache) Contains(ctx context.Context, element any) (bool, error)
- func (s *RSetCache) ContainsAll(ctx context.Context, elements ...any) (bool, error)
- func (o *RSetCache) Delete(ctx context.Context) error
- func (o *RSetCache) Exists(ctx context.Context) (bool, error)
- func (o *RSetCache) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RSetCache) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (s *RSetCache) Members(ctx context.Context) ([]any, error)
- func (o *RSetCache) Name() string
- func (s *RSetCache) Random(ctx context.Context) (any, error)
- func (s *RSetCache) RandomN(ctx context.Context, n int64) ([]any, error)
- func (s *RSetCache) ReadAll(ctx context.Context) ([]any, error)
- func (o *RSetCache) RemainTTL(ctx context.Context) (time.Duration, error)
- func (s *RSetCache) Remove(ctx context.Context, element any) (bool, error)
- func (s *RSetCache) RemoveAll(ctx context.Context, elements ...any) (bool, error)
- func (s *RSetCache) RemoveRandom(ctx context.Context) (any, error)
- func (s *RSetCache) RemoveRandomN(ctx context.Context, n int64) ([]any, error)
- func (o *RSetCache) Rename(ctx context.Context, newName string) error
- func (s *RSetCache) RetainAll(ctx context.Context, elements ...any) (bool, error)
- func (s *RSetCache) Size(ctx context.Context) (int64, error)
- func (o *RSetCache) Touch(ctx context.Context) (bool, error)
- func (s *RSetCache) TryAdd(ctx context.Context, element any, ttl time.Duration) (bool, error)
- func (o *RSetCache) Unlink(ctx context.Context) error
- type RSetMultimap
- func (o *RSetMultimap) ClearExpire(ctx context.Context) (bool, error)
- func (o *RSetMultimap) Delete(ctx context.Context) error
- func (o *RSetMultimap) Exists(ctx context.Context) (bool, error)
- func (o *RSetMultimap) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RSetMultimap) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o *RSetMultimap) Name() string
- func (o *RSetMultimap) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RSetMultimap) Rename(ctx context.Context, newName string) error
- func (o *RSetMultimap) Touch(ctx context.Context) (bool, error)
- func (o *RSetMultimap) Unlink(ctx context.Context) error
- type RSetMultimapCache
- func (m RSetMultimapCache) Clear(ctx context.Context) error
- func (m RSetMultimapCache) ContainsEntry(ctx context.Context, key, value any) (bool, error)
- func (m RSetMultimapCache) ContainsKey(ctx context.Context, key any) (bool, error)
- func (m RSetMultimapCache) ContainsValue(ctx context.Context, value any) (bool, error)
- func (m RSetMultimapCache) Delete(ctx context.Context) error
- func (m RSetMultimapCache) Entries(ctx context.Context) ([]MultimapEntry, error)
- func (m RSetMultimapCache) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (m RSetMultimapCache) ExpireKey(ctx context.Context, key any, ttl time.Duration) (bool, error)
- func (m RSetMultimapCache) Get(ctx context.Context, key any) ([]any, error)
- func (m RSetMultimapCache) GetFairLock(key any) *RFairLock
- func (m RSetMultimapCache) GetLock(key any) *RLock
- func (m RSetMultimapCache) GetReadWriteLock(key any) *RReadWriteLock
- func (m RSetMultimapCache) GetSemaphore(key any) *RSemaphore
- func (m RSetMultimapCache) IsEmpty(ctx context.Context) (bool, error)
- func (m RSetMultimapCache) KeySet(ctx context.Context) ([]any, error)
- func (m RSetMultimapCache) KeySize(ctx context.Context) (int64, error)
- func (m RSetMultimapCache) Put(ctx context.Context, key, value any) (bool, error)
- func (m RSetMultimapCache) PutAll(ctx context.Context, key any, values ...any) (bool, error)
- func (m RSetMultimapCache) ReadAllKeySet(ctx context.Context) ([]any, error)
- func (m RSetMultimapCache) RemoveAll(ctx context.Context, key any) (bool, error)
- func (m RSetMultimapCache) ReplaceValues(ctx context.Context, key any, values ...any) ([]any, error)
- func (m RSetMultimapCache) Size(ctx context.Context) (int64, error)
- func (m RSetMultimapCache) StartAutoEviction(interval time.Duration)
- func (m RSetMultimapCache) Values(ctx context.Context) ([]any, error)
- type RSetMultimapCacheNative
- func (o RSetMultimapCacheNative) ClearExpire(ctx context.Context) (bool, error)
- func (o RSetMultimapCacheNative) Delete(ctx context.Context) error
- func (o RSetMultimapCacheNative) Exists(ctx context.Context) (bool, error)
- func (o RSetMultimapCacheNative) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o RSetMultimapCacheNative) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (m *RSetMultimapCacheNative) ExpireKey(ctx context.Context, key any, ttl time.Duration) (bool, error)
- func (o RSetMultimapCacheNative) Name() string
- func (o RSetMultimapCacheNative) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o RSetMultimapCacheNative) Rename(ctx context.Context, newName string) error
- func (o RSetMultimapCacheNative) Touch(ctx context.Context) (bool, error)
- func (o RSetMultimapCacheNative) Unlink(ctx context.Context) error
- type RShardedTopic
- func (o *RShardedTopic) ClearExpire(ctx context.Context) (bool, error)
- func (t *RShardedTopic) CountSubscribers(ctx context.Context) (int64, error)
- func (o *RShardedTopic) Delete(ctx context.Context) error
- func (o *RShardedTopic) Exists(ctx context.Context) (bool, error)
- func (o *RShardedTopic) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RShardedTopic) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o *RShardedTopic) Name() string
- func (t *RShardedTopic) Publish(ctx context.Context, message any) (int64, error)
- func (o *RShardedTopic) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RShardedTopic) Rename(ctx context.Context, newName string) error
- func (t *RShardedTopic) Subscribe(listener func(msg any)) (int, error)
- func (o *RShardedTopic) Touch(ctx context.Context) (bool, error)
- func (o *RShardedTopic) Unlink(ctx context.Context) error
- func (t *RShardedTopic) Unsubscribe(id int) bool
- type RSpinLock
- func (o RSpinLock) ClearExpire(ctx context.Context) (bool, error)
- func (o RSpinLock) Delete(ctx context.Context) error
- func (o RSpinLock) Exists(ctx context.Context) (bool, error)
- func (o RSpinLock) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o RSpinLock) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (l *RSpinLock) Lock(ctx context.Context, clientID string, ttl time.Duration) error
- func (o RSpinLock) Name() string
- func (o RSpinLock) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o RSpinLock) Rename(ctx context.Context, newName string) error
- func (o RSpinLock) Touch(ctx context.Context) (bool, error)
- func (l *RSpinLock) TryLockWait(ctx context.Context, clientID string, wait, ttl time.Duration) (bool, error)
- func (o RSpinLock) Unlink(ctx context.Context) error
- type RStream
- func (s *RStream) Ack(ctx context.Context, group string, ids ...string) (int64, error)
- func (s *RStream) Add(ctx context.Context, fields map[string]any) (string, error)
- func (s *RStream) AddWithID(ctx context.Context, id string, fields map[string]any) (string, error)
- func (s *RStream) AddWithMaxLen(ctx context.Context, fields map[string]any, maxLen int64, approximate bool) (string, error)
- func (s *RStream) AutoClaim(ctx context.Context, group, consumer string, minIdle time.Duration, ...) ([]StreamEntry, string, error)
- func (s *RStream) Claim(ctx context.Context, group, consumer string, minIdle time.Duration, ...) ([]StreamEntry, error)
- func (o *RStream) ClearExpire(ctx context.Context) (bool, error)
- func (s *RStream) CreateConsumer(ctx context.Context, group, consumer string) (bool, error)
- func (s *RStream) CreateGroup(ctx context.Context, group, id string) (bool, error)
- func (o *RStream) Delete(ctx context.Context) error
- func (s *RStream) DeleteGroup(ctx context.Context, group string) (bool, error)
- func (o *RStream) Exists(ctx context.Context) (bool, error)
- func (o *RStream) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RStream) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (s *RStream) FastAutoClaim(ctx context.Context, group, consumer string, minIdle time.Duration, ...) ([]string, string, error)
- func (s *RStream) FastClaim(ctx context.Context, group, consumer string, minIdle time.Duration, ...) ([]string, error)
- func (s *RStream) GetInfo(ctx context.Context) (*redis.XInfoStream, error)
- func (s *RStream) Len(ctx context.Context) (int64, error)
- func (s *RStream) ListConsumers(ctx context.Context, group string) ([]redis.XInfoConsumer, error)
- func (s *RStream) ListGroups(ctx context.Context) ([]redis.XInfoGroup, error)
- func (s *RStream) Nack(ctx context.Context, group string, mode StreamNackMode, ids ...string) (int64, error)
- func (o *RStream) Name() string
- func (s *RStream) PendingInfo(ctx context.Context, group string) (*redis.XPending, error)
- func (s *RStream) PendingRange(ctx context.Context, group, consumer string, count int64) ([]PendingEntry, error)
- func (s *RStream) Read(ctx context.Context, id string, count int64, block time.Duration) ([]StreamEntry, error)
- func (s *RStream) ReadGroup(ctx context.Context, group, consumer string, count int64, block time.Duration) ([]StreamEntry, error)
- func (s *RStream) ReadRange(ctx context.Context, start, end string, count int64) ([]StreamEntry, error)
- func (s *RStream) ReadReverse(ctx context.Context, end, start string, count int64) ([]StreamEntry, error)
- func (o *RStream) RemainTTL(ctx context.Context) (time.Duration, error)
- func (s *RStream) Remove(ctx context.Context, ids ...string) (int64, error)
- func (s *RStream) RemoveConsumer(ctx context.Context, group, consumer string) (int64, error)
- func (o *RStream) Rename(ctx context.Context, newName string) error
- func (o *RStream) Touch(ctx context.Context) (bool, error)
- func (s *RStream) Trim(ctx context.Context, maxLen int64, approximate bool) (int64, error)
- func (s *RStream) TrimMinID(ctx context.Context, minID string, approximate bool) (int64, error)
- func (o *RStream) Unlink(ctx context.Context) error
- func (s *RStream) UpdateGroupMessageID(ctx context.Context, group, id string) error
- type RTDigest
- func (t *RTDigest) Add(ctx context.Context, values ...float64) error
- func (t *RTDigest) CDF(ctx context.Context, values ...float64) ([]float64, error)
- func (o *RTDigest) ClearExpire(ctx context.Context) (bool, error)
- func (o *RTDigest) Delete(ctx context.Context) error
- func (o *RTDigest) Exists(ctx context.Context) (bool, error)
- func (o *RTDigest) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RTDigest) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (t *RTDigest) Max(ctx context.Context) (float64, error)
- func (t *RTDigest) Min(ctx context.Context) (float64, error)
- func (o *RTDigest) Name() string
- func (t *RTDigest) Quantile(ctx context.Context, quantiles ...float64) ([]float64, error)
- func (o *RTDigest) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RTDigest) Rename(ctx context.Context, newName string) error
- func (o *RTDigest) Touch(ctx context.Context) (bool, error)
- func (t *RTDigest) TryCreate(ctx context.Context) (bool, error)
- func (t *RTDigest) TryCreateWithCompression(ctx context.Context, compression int64) (bool, error)
- func (o *RTDigest) Unlink(ctx context.Context) error
- type RTimeSeries
- func (s *RTimeSeries) Add(ctx context.Context, timestampMs int64, value any, label string, ...) error
- func (s *RTimeSeries) AddAll(ctx context.Context, entries ...TimeSeriesEntry) error
- func (o *RTimeSeries) ClearExpire(ctx context.Context) (bool, error)
- func (s *RTimeSeries) Delete(ctx context.Context) error
- func (o *RTimeSeries) Exists(ctx context.Context) (bool, error)
- func (o *RTimeSeries) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RTimeSeries) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (s *RTimeSeries) FirstEntries(ctx context.Context, count int) ([]TimeSeriesEntry, error)
- func (s *RTimeSeries) FirstEntry(ctx context.Context) (*TimeSeriesEntry, error)
- func (s *RTimeSeries) FirstTimestamp(ctx context.Context) (int64, error)
- func (s *RTimeSeries) Get(ctx context.Context, timestampMs int64) (*TimeSeriesEntry, error)
- func (s *RTimeSeries) GetAndRemove(ctx context.Context, timestampMs int64) (any, error)
- func (s *RTimeSeries) GetAndRemoveEntry(ctx context.Context, timestampMs int64) (*TimeSeriesEntry, error)
- func (s *RTimeSeries) LastEntries(ctx context.Context, count int) ([]TimeSeriesEntry, error)
- func (s *RTimeSeries) LastEntry(ctx context.Context) (*TimeSeriesEntry, error)
- func (s *RTimeSeries) LastTimestamp(ctx context.Context) (int64, error)
- func (o *RTimeSeries) Name() string
- func (s *RTimeSeries) PollFirstEntries(ctx context.Context, count int) ([]TimeSeriesEntry, error)
- func (s *RTimeSeries) PollLastEntries(ctx context.Context, count int) ([]TimeSeriesEntry, error)
- func (s *RTimeSeries) Range(ctx context.Context, fromMs, toMs int64, limit int64) ([]TimeSeriesEntry, error)
- func (s *RTimeSeries) RangeReversed(ctx context.Context, fromMs, toMs int64, limit int64) ([]TimeSeriesEntry, error)
- func (o *RTimeSeries) RemainTTL(ctx context.Context) (time.Duration, error)
- func (s *RTimeSeries) Remove(ctx context.Context, timestampMs int64) (int64, error)
- func (s *RTimeSeries) RemoveRange(ctx context.Context, fromMs, toMs int64) (int64, error)
- func (o *RTimeSeries) Rename(ctx context.Context, newName string) error
- func (s *RTimeSeries) Size(ctx context.Context) (int64, error)
- func (o *RTimeSeries) Touch(ctx context.Context) (bool, error)
- func (o *RTimeSeries) Unlink(ctx context.Context) error
- type RTopK
- func (t *RTopK) Add(ctx context.Context, elements ...any) ([]string, error)
- func (o *RTopK) ClearExpire(ctx context.Context) (bool, error)
- func (o *RTopK) Delete(ctx context.Context) error
- func (o *RTopK) Exists(ctx context.Context) (bool, error)
- func (o *RTopK) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RTopK) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (t *RTopK) List(ctx context.Context) ([]string, error)
- func (t *RTopK) ListWithCount(ctx context.Context) (map[string]int64, error)
- func (o *RTopK) Name() string
- func (t *RTopK) Query(ctx context.Context, elements ...any) ([]bool, error)
- func (o *RTopK) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o *RTopK) Rename(ctx context.Context, newName string) error
- func (o *RTopK) Touch(ctx context.Context) (bool, error)
- func (t *RTopK) TryInit(ctx context.Context, k int64) (bool, error)
- func (o *RTopK) Unlink(ctx context.Context) error
- type RTopic
- func (t *RTopic) ChannelNames() []string
- func (o *RTopic) ClearExpire(ctx context.Context) (bool, error)
- func (t *RTopic) CountListeners() int
- func (t *RTopic) CountSubscribers(ctx context.Context) (int64, error)
- func (o *RTopic) Delete(ctx context.Context) error
- func (o *RTopic) Exists(ctx context.Context) (bool, error)
- func (o *RTopic) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RTopic) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (t *RTopic) GetChannelNames() []string
- func (o *RTopic) Name() string
- func (t *RTopic) Publish(ctx context.Context, message any) (int64, error)
- func (o *RTopic) RemainTTL(ctx context.Context) (time.Duration, error)
- func (t *RTopic) RemoveAllListeners()
- func (o *RTopic) Rename(ctx context.Context, newName string) error
- func (t *RTopic) Subscribe(listener func(msg any)) (int, error)
- func (o *RTopic) Touch(ctx context.Context) (bool, error)
- func (o *RTopic) Unlink(ctx context.Context) error
- func (t *RTopic) Unsubscribe(id int) bool
- type RTransferQueue
- func (o RTransferQueue) ClearExpire(ctx context.Context) (bool, error)
- func (o RTransferQueue) Delete(ctx context.Context) error
- func (o RTransferQueue) Exists(ctx context.Context) (bool, error)
- func (o RTransferQueue) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o RTransferQueue) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (o RTransferQueue) Name() string
- func (o RTransferQueue) RemainTTL(ctx context.Context) (time.Duration, error)
- func (o RTransferQueue) Rename(ctx context.Context, newName string) error
- func (o RTransferQueue) Touch(ctx context.Context) (bool, error)
- func (q *RTransferQueue) Transfer(ctx context.Context, destination string) (any, error)
- func (q *RTransferQueue) TryTransfer(ctx context.Context, destination string, timeout time.Duration) (any, error)
- func (o RTransferQueue) Unlink(ctx context.Context) error
- type RVectorSet
- func (v *RVectorSet) Add(ctx context.Context, element string, vector []float64) (bool, error)
- func (o *RVectorSet) ClearExpire(ctx context.Context) (bool, error)
- func (v *RVectorSet) Contains(ctx context.Context, element string) (bool, error)
- func (o *RVectorSet) Delete(ctx context.Context) error
- func (v *RVectorSet) Dimensions(ctx context.Context) (int64, error)
- func (o *RVectorSet) Exists(ctx context.Context) (bool, error)
- func (o *RVectorSet) Expire(ctx context.Context, ttl time.Duration) (bool, error)
- func (o *RVectorSet) ExpireAt(ctx context.Context, ts time.Time) (bool, error)
- func (v *RVectorSet) GetVector(ctx context.Context, element string) ([]float64, error)
- func (o *RVectorSet) Name() string
- func (o *RVectorSet) RemainTTL(ctx context.Context) (time.Duration, error)
- func (v *RVectorSet) Remove(ctx context.Context, element string) (bool, error)
- func (o *RVectorSet) Rename(ctx context.Context, newName string) error
- func (v *RVectorSet) SimilarByElement(ctx context.Context, element string, count int) ([]string, error)
- func (v *RVectorSet) SimilarByVector(ctx context.Context, vector []float64, count int) ([]string, error)
- func (v *RVectorSet) Size(ctx context.Context) (int64, error)
- func (o *RVectorSet) Touch(ctx context.Context) (bool, error)
- func (o *RVectorSet) Unlink(ctx context.Context) error
- type RateLimiterConfig
- type RateType
- type ScriptReturnType
- type SearchDocument
- type SearchOptions
- type SearchResult
- type StreamEntry
- type StreamNackMode
- type TimeSeriesEntry
Examples ¶
Constants ¶
const ( EventCreated = "created" EventUpdated = "updated" EventRemoved = "removed" EventExpired = "expired" )
MapCache event kinds (channel suffixes).
Variables ¶
ErrClientSideCachingUnavailable is returned when a scoped CSC client cannot be created (non-single mode, non-zero DB, or RESP2 forced).
var ErrIDAlloc = errors.New("redi: id range allocation failed")
ErrIDAlloc is returned when the id generator fails to allocate a range.
var ErrLockNotHeld = errors.New("redi: lock not held")
ErrLockNotHeld is returned by Unlock when the caller does not own the lock.
var ErrLockReentrant = errors.New("redi: non-reentrant lock is already held by caller")
ErrLockReentrant is returned when a non-reentrant lock's current holder attempts to acquire it again.
var ErrMultiLockFailed = errors.New("redi: multilock acquisition failed")
ErrMultiLockFailed is returned by Lock when the context ends before all member locks are acquired (acquired members are rolled back).
var ErrNoPermit = errors.New("redi: no permit acquired")
ErrNoPermit is returned by Acquire when the context ends first.
var ErrRedLockFailed = errors.New("redi: redlock majority acquisition failed")
ErrRedLockFailed is returned when the majority cannot be acquired within the requested wait budget.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the central entry point for all redi.go operations. It wraps a redis.UniversalClient (single / cluster / sentinel) and exposes factory methods for distributed data-structure objects.
func NewClient ¶
NewClient creates a new Client using the provided Config and verifies the connection with a PING.
Example ¶
package main
import (
"context"
"fmt"
"log"
redi "github.com/linkerlin/redi.go"
)
func main() {
client, err := redi.NewClient(redi.DefaultConfig())
if err != nil {
log.Fatal(err)
}
defer client.Close() //nolint:errcheck // example
ctx := context.Background()
// A distributed lock: ttl<=0 enables the watchdog auto-renewal.
lock := client.GetLock("demo:lock")
holder := client.HolderID("1")
if err := lock.Lock(ctx, holder, 0); err != nil {
log.Fatal(err)
}
defer lock.Unlock(ctx, holder) //nolint:errcheck // example
// A distributed map (Redisson wire-compatible values).
_, _ = client.GetKeys().Delete(ctx, "demo:map")
m := client.GetMap("demo:map")
_ = m.Put(ctx, "greeting", "hello")
v, _ := m.Get(ctx, "greeting")
fmt.Println(v)
}
Output: hello
func (*Client) Close ¶
Close cancels all background goroutines (watchdogs, delayed-queue workers, topic listeners) and shuts down the underlying connection pool.
func (*Client) Config ¶ added in v0.2.13
Config returns a copy of the client Config (read-only snapshot).
func (*Client) GetArray ¶ added in v0.2.13
GetArray returns a Redis 8.8+ ARRAY object (AR* commands).
func (*Client) GetAtomicDouble ¶
func (c *Client) GetAtomicDouble(name string) *RAtomicDouble
GetAtomicDouble returns a distributed atomic double.
func (*Client) GetAtomicLong ¶
func (c *Client) GetAtomicLong(name string) *RAtomicLong
GetAtomicLong is the Redisson-style alias for GetRAtomicLong.
func (*Client) GetBinaryStream ¶ added in v0.2.13
func (c *Client) GetBinaryStream(name string) *RBinaryStream
GetBinaryStream returns a raw-byte stream backed by a Redis String.
func (*Client) GetBitSet ¶ added in v0.2.2
GetBitSet returns a distributed bitset (raw Redis bit numbering).
func (*Client) GetBlockingDeque ¶
func (c *Client) GetBlockingDeque(name string) *RBlockingDeque
GetBlockingDeque returns a deque with blocking consumption from both ends.
func (*Client) GetBlockingQueue ¶
func (c *Client) GetBlockingQueue(name string) *RBlockingQueue
GetBlockingQueue returns a queue with blocking consumption.
func (*Client) GetBloomFilter ¶
func (c *Client) GetBloomFilter(name string) *RBloomFilter
GetBloomFilter returns a distributed bloom filter.
func (*Client) GetBloomFilterNative ¶ added in v0.2.13
func (c *Client) GetBloomFilterNative(name string) *RBloomFilterNative
GetBloomFilterNative returns a bloom filter backed by Redis BF.* commands.
func (*Client) GetBoundedBlockingQueue ¶ added in v0.2.13
func (c *Client) GetBoundedBlockingQueue(name string) *RBoundedBlockingQueue
GetBoundedBlockingQueue returns a capacity-bounded blocking queue.
func (*Client) GetBuckets ¶
GetBuckets returns the batch bucket operations facade.
func (*Client) GetCircularBuffer ¶ added in v0.2.13
func (c *Client) GetCircularBuffer(name string) *RCircularBuffer
GetCircularBuffer returns a Redis 8.8+ ARRAY circular buffer (≠ RRingBuffer).
func (*Client) GetClientSideCaching ¶ added in v0.2.13
func (c *Client) GetClientSideCaching() *RClientSideCaching
GetClientSideCaching returns a facade over this Client. Caching only occurs when Config.ClientSideCaching was set at NewClient, or use GetClientSideCachingWithOptions for a dedicated tracked pool (closer to Redisson getClientSideCaching(options)).
func (*Client) GetClientSideCachingWithOptions ¶ added in v0.2.13
func (c *Client) GetClientSideCachingWithOptions(opts *ClientSideCachingOptions) (*RClientSideCaching, error)
GetClientSideCachingWithOptions creates a dedicated RESP3 CLIENT TRACKING client (ModeSingle, DB 0) and returns an owned RClientSideCaching. Caller must Destroy() it (or rely on parent Close after registering via t.Cleanup in tests). Nil opts use go-redis defaults.
func (*Client) GetCountDownLatch ¶
func (c *Client) GetCountDownLatch(name string) *RCountDownLatch
GetCountDownLatch returns a distributed countdown latch.
func (*Client) GetCuckooFilter ¶ added in v0.2.13
func (c *Client) GetCuckooFilter(name string) *RCuckooFilter
GetCuckooFilter returns a cuckoo filter backed by Redis CF.* commands.
func (*Client) GetDelayedQueue ¶
func (c *Client) GetDelayedQueue(name string) *RDelayedQueue
GetDelayedQueue returns a delayed-delivery queue feeding the named queue.
func (*Client) GetDoubleAdder ¶ added in v0.2.8
func (c *Client) GetDoubleAdder(name string) *RDoubleAdder
GetDoubleAdder returns the double variant of GetLongAdder.
func (*Client) GetFairLock ¶ added in v0.2.13
GetFairLock returns a FIFO, re-entrant distributed lock.
func (*Client) GetFencedLock ¶ added in v0.2.10
func (c *Client) GetFencedLock(name string) *RFencedLock
GetFencedLock returns a re-entrant lock whose acquisitions increment a fencing token (redisson_lock_token:{name}).
func (*Client) GetFunction ¶ added in v0.2.12
GetFunction returns the Redis functions facade (FUNCTION/FCALL).
func (*Client) GetGcra ¶ added in v0.2.13
GetGcra returns a GCRA rate limiter (Redis GCRA command when available).
func (*Client) GetHyperLogLog ¶ added in v0.2.2
func (c *Client) GetHyperLogLog(name string) *RHyperLogLog
GetHyperLogLog returns a cardinality estimator (PFADD/PFCOUNT).
func (*Client) GetIdGenerator ¶
func (c *Client) GetIdGenerator(name string) *RIdGenerator
GetIdGenerator returns a distributed id generator.
func (*Client) GetJsonBucket ¶ added in v0.2.13
func (c *Client) GetJsonBucket(name string) *RJsonBucket
GetJsonBucket returns a RedisJSON document bucket (JSON.* commands).
func (*Client) GetJsonBuckets ¶ added in v0.2.13
func (c *Client) GetJsonBuckets() *RJsonBuckets
GetJsonBuckets returns mass JSON bucket helpers.
func (*Client) GetLexSortedSet ¶
func (c *Client) GetLexSortedSet(name string) *RLexSortedSet
GetLexSortedSet returns a lexicographically sorted set (raw members).
func (*Client) GetListMultimap ¶
func (c *Client) GetListMultimap(name string) *RListMultimap
GetListMultimap returns a multimap with ordered value lists per key.
func (*Client) GetListMultimapCache ¶ added in v0.2.13
func (c *Client) GetListMultimapCache(name string) *RListMultimapCache
GetListMultimapCache returns a list multimap with per-key expiration.
func (*Client) GetListMultimapCacheNative ¶ added in v0.2.13
func (c *Client) GetListMultimapCacheNative(name string) *RListMultimapCacheNative
GetListMultimapCacheNative returns a list multimap with native per-key HPEXPIRE.
func (*Client) GetLocalCachedMap ¶ added in v0.2.5
func (c *Client) GetLocalCachedMap(name string) *RLocalCachedMap
GetLocalCachedMap returns a map with an in-process near cache (write-through + cross-instance invalidation broadcast).
func (*Client) GetLocalCachedMapWithOptions ¶ added in v0.2.13
func (c *Client) GetLocalCachedMapWithOptions(name string, opts *LocalCachedMapOptions) *RLocalCachedMap
GetLocalCachedMapWithOptions returns a local cached map with options (e.g. DisableNearCache for mixed Java/Go deployments).
func (*Client) GetLongAdder ¶ added in v0.2.8
func (c *Client) GetLongAdder(name string) *RLongAdder
GetLongAdder returns a high-contention distributed counter (local buffer + coordinated flush on Sum).
func (*Client) GetMapCache ¶
GetMapCache returns a distributed map with per-entry TTL/maxIdle.
func (*Client) GetMapCacheNative ¶ added in v0.2.13
func (c *Client) GetMapCacheNative(name string) *RMapCacheNative
GetMapCacheNative returns a map with per-entry TTL via Redis HPEXPIRE (Redis ≥7.4).
func (*Client) GetMaps ¶ added in v0.2.13
GetMaps returns mass HASH map import helpers (DEL+HSET per map).
func (*Client) GetMultiLock ¶ added in v0.2.13
func (c *Client) GetMultiLock(locks ...*RLock) *RMultiLock
GetMultiLock is the Redisson-style alias for NewMultiLock.
func (*Client) GetNonReentrantFairLock ¶ added in v0.2.13
func (c *Client) GetNonReentrantFairLock(name string) *RNonReentrantFairLock
GetNonReentrantFairLock returns a FIFO lock that rejects holder re-entry.
func (*Client) GetNonReentrantLock ¶ added in v0.2.13
func (c *Client) GetNonReentrantLock(name string) *RNonReentrantLock
GetNonReentrantLock returns a lock that refuses re-entry by the same holder.
func (*Client) GetPatternTopic ¶
func (c *Client) GetPatternTopic(pattern string) *RPatternTopic
GetPatternTopic returns a pattern (PSUBSCRIBE) topic.
func (*Client) GetPermitExpirableSemaphore ¶ added in v0.2.4
func (c *Client) GetPermitExpirableSemaphore(name string) *RPermitExpirableSemaphore
GetPermitExpirableSemaphore returns a semaphore with individually leased, self-expiring permits.
func (*Client) GetPriorityBlockingDeque ¶ added in v0.2.13
func (c *Client) GetPriorityBlockingDeque(name string) *RPriorityBlockingDeque
GetPriorityBlockingDeque returns a BZPOPMIN/BZPOPMAX wrapper over the ZSET priority queue. Not Java Comparator RPriorityBlockingDeque.
func (*Client) GetPriorityBlockingQueue ¶ added in v0.2.13
func (c *Client) GetPriorityBlockingQueue(name string) *RPriorityBlockingQueue
GetPriorityBlockingQueue returns a BZPOPMIN wrapper over GetPriorityQueue. Not Java Comparator RPriorityBlockingQueue.
func (*Client) GetPriorityDeque ¶ added in v0.2.13
func (c *Client) GetPriorityDeque(name string) *RPriorityDeque
GetPriorityDeque returns non-blocking double-ended ZSET pops. Not Java Comparator RPriorityDeque.
func (*Client) GetPriorityQueue ¶ added in v0.2.6
func (c *Client) GetPriorityQueue(name string) *RPriorityQueue
GetPriorityQueue returns a ZSET-backed priority queue (lower score = higher priority). Not Java Comparator RPriorityQueue — see COMPATIBILITY.
func (*Client) GetQueueTransfer ¶ added in v0.2.13
func (c *Client) GetQueueTransfer(name string) *RTransferQueue
GetQueueTransfer is the honest alias of GetTransferQueue (GO_ONLY semantics).
func (*Client) GetRAtomicLong ¶
func (c *Client) GetRAtomicLong(name string) *RAtomicLong
GetRAtomicLong returns a distributed atomic counter for the given name.
func (*Client) GetRateLimiter ¶
func (c *Client) GetRateLimiter(name string) *RRateLimiter
GetRateLimiter returns a distributed rate limiter.
func (*Client) GetReadWriteLock ¶
func (c *Client) GetReadWriteLock(name string) *RReadWriteLock
GetReadWriteLock returns a distributed read-write lock for the given name.
func (*Client) GetRedisNodes ¶ added in v0.2.13
func (c *Client) GetRedisNodes() *RRedisNodes
GetRedisNodes returns a thin topology probe (PING / Info) for the current mode.
func (*Client) GetReliableTopic ¶ added in v0.2.4
func (c *Client) GetReliableTopic(name string) *RReliableTopic
GetReliableTopic returns a reliable (Stream-backed) pub/sub topic.
func (*Client) GetRingBuffer ¶ added in v0.2.12
func (c *Client) GetRingBuffer(name string) *RRingBuffer
GetRingBuffer returns a capacity-bounded FIFO that evicts on overflow.
func (*Client) GetScoredSortedSet ¶
func (c *Client) GetScoredSortedSet(name string) *RScoredSortedSet
GetScoredSortedSet returns a distributed sorted set (Redis ZSET).
func (*Client) GetSearch ¶ added in v0.2.13
GetSearch returns a RediSearch facade (FT.CREATE/SEARCH/DROPINDEX subset).
func (*Client) GetSemaphore ¶
func (c *Client) GetSemaphore(name string) *RSemaphore
GetSemaphore returns a distributed counting semaphore.
func (*Client) GetSetCache ¶
GetSetCache returns a set with per-element TTL/maxIdle.
func (*Client) GetSetMultimap ¶
func (c *Client) GetSetMultimap(name string) *RSetMultimap
GetSetMultimap returns a multimap with unordered value sets per key.
func (*Client) GetSetMultimapCache ¶ added in v0.2.13
func (c *Client) GetSetMultimapCache(name string) *RSetMultimapCache
GetSetMultimapCache returns a set multimap with per-key expiration.
func (*Client) GetSetMultimapCacheNative ¶ added in v0.2.13
func (c *Client) GetSetMultimapCacheNative(name string) *RSetMultimapCacheNative
GetSetMultimapCacheNative returns a set multimap with native per-key HPEXPIRE.
func (*Client) GetShardedTopic ¶ added in v0.2.12
func (c *Client) GetShardedTopic(name string) *RShardedTopic
GetShardedTopic returns a Redis 7+ sharded pub/sub topic (SSUBSCRIBE).
func (*Client) GetSpinLock ¶ added in v0.2.13
GetSpinLock returns a re-entrant lock that busy-waits instead of pub/sub.
func (*Client) GetStream ¶ added in v0.2.3
GetStream returns a distributed log stream (Redis Stream).
func (*Client) GetTDigest ¶ added in v0.2.13
GetTDigest returns a t-digest sketch backed by Redis TDIGEST.* commands.
func (*Client) GetTimeSeries ¶ added in v0.2.11
func (c *Client) GetTimeSeries(name string) *RTimeSeries
GetTimeSeries returns a time-series store (Redisson wire-compatible).
func (*Client) GetTopK ¶ added in v0.2.13
GetTopK returns a Top-K sketch backed by Redis TOPK.* commands.
func (*Client) GetTransferQueue ¶
func (c *Client) GetTransferQueue(name string) *RTransferQueue
GetTransferQueue returns a Go-only queue-to-queue migrate helper. Not Redisson RTransferQueue (RemoteService). Prefer GetQueueTransfer.
func (*Client) GetVectorSet ¶ added in v0.2.13
func (c *Client) GetVectorSet(name string) *RVectorSet
GetVectorSet returns a Redis 8+ vector set (VADD/VSIM/…).
func (*Client) HolderID ¶ added in v0.2.13
HolderID builds a Redisson-shaped lock HASH field "{clientUUID}:{threadID}". Use the same threadID for Lock/Unlock/re-entry on one logical holder. An empty threadID becomes "0".
func (*Client) NewMultiLock ¶ added in v0.2.10
func (c *Client) NewMultiLock(locks ...*RLock) *RMultiLock
NewMultiLock groups RLocks into one all-or-nothing lock.
func (*Client) NewRedLock ¶ added in v0.2.13
NewRedLock groups independent RLocks using RedissonRedLock majority rules.
func (*Client) Redis ¶
func (c *Client) Redis() redis.UniversalClient
Redis returns the underlying redis.UniversalClient for advanced direct use.
type ClientSideCachingOptions ¶ added in v0.2.13
type ClientSideCachingOptions struct {
// MaxEntries limits cached replies; ≤0 lets go-redis apply its default bound.
MaxEntries int
// MaxMemoryBytes limits estimated cache memory; ≤0 means unlimited (subject
// to MaxEntries defaulting).
MaxMemoryBytes int64
// DrainInterval bounds how often buffered invalidate frames are drained
// (go-redis default ~5ms when zero).
DrainInterval time.Duration
// MaxStaleness caps how long a cached entry may be served without a fresh
// fetch (0 = disabled). A backstop for lost invalidations.
MaxStaleness time.Duration
}
ClientSideCachingOptions configures go-redis ClientSideCacheConfig (alias of CacheConfig). Eviction is LRU-ish inside go-redis LocalCache — not Java's EvictionPolicy enum (LRU/LFU/SOFT/WEAK).
type Codec ¶
Codec encodes and decodes values stored in Redis, mirroring Redisson's codec layer. The default JSONCodec is wire-compatible with Redisson configured with JsonJacksonCodec (without type info) and with redi.py:
- Strings, bools, floats and small ints are stored as bare JSON.
- Ints outside the 32-bit range are wrapped as ["java.lang.Long", v] (matching Redisson's Long wrapping).
- Decode unwraps ["java.lang.Long", v] / ["java.util.ArrayList", v]-style typed wrappers and strips JsonJacksonCodec "@class" fields.
- Bytes that are not valid JSON decode to the raw string unchanged.
type Config ¶
type Config struct {
// Mode selects single / cluster / sentinel topology.
Mode Mode
// Addrs holds server addresses: the node for single, seed nodes for
// cluster, sentinel addresses for sentinel mode.
// Defaults to ["localhost:6379"].
Addrs []string
// MasterName is the sentinel master set name (sentinel mode only).
MasterName string
// Username for AUTH (empty if none).
Username string
// Password for authentication (empty if none).
Password string
// DB is the database number (single mode only).
DB int
// PoolSize is the number of connections in the pool.
PoolSize int
// DialTimeout for establishing new connections.
DialTimeout time.Duration
// ReadTimeout for socket reads.
ReadTimeout time.Duration
// WriteTimeout for socket writes.
WriteTimeout time.Duration
// Codec encodes/decodes values. Defaults to JSONCodec
// (Redisson JsonJacksonCodec-compatible).
Codec Codec
// LockWatchdogTimeout is the lease time used by RLock when no explicit
// TTL is given; the watchdog renews it every LockWatchdogTimeout/3.
// Defaults to 30s (matching Redisson's lockWatchdogTimeout).
LockWatchdogTimeout time.Duration
// Logger receives background-goroutine error reports.
// Defaults to the standard log package.
Logger Logger
// Protocol is the RESP version passed to go-redis (2 or 3). Zero lets
// go-redis pick its default (currently 3). Required to be 3 when
// ClientSideCaching is set.
Protocol int
// ClientSideCaching enables go-redis RESP3 client-side caching on
// standalone ModeSingle clients (DB 0). Cluster/Sentinel ignore this
// option. Prefer GetClientSideCachingWithOptions for a Redisson-shaped
// runtime scope that owns its own tracked connection pool.
ClientSideCaching *ClientSideCachingOptions
}
Config holds connection and behaviour options for a Client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults for Redis 8.x.
type EvictionMode ¶ added in v0.2.13
type EvictionMode string
EvictionMode controls which entries a size-limited map cache evicts.
const ( EvictionModeLRU EvictionMode = "LRU" EvictionModeLFU EvictionMode = "LFU" )
type GcraResult ¶ added in v0.2.13
GcraResult mirrors Redisson's GcraResult.
type GeoLocation ¶ added in v0.2.13
GeoLocation describes one member and its longitude/latitude.
type IndexField ¶ added in v0.2.13
type IndexField struct {
Name string
Type IndexFieldType
Alias string
}
IndexField describes one SCHEMA field.
type IndexFieldType ¶ added in v0.2.13
type IndexFieldType string
IndexFieldType is a RediSearch schema field type.
const ( IndexText IndexFieldType = "TEXT" IndexNumeric IndexFieldType = "NUMERIC" IndexTag IndexFieldType = "TAG" IndexGeo IndexFieldType = "GEO" )
type IndexOptions ¶ added in v0.2.13
IndexOptions configures FT.CREATE.
type JSONCodec ¶
type JSONCodec struct{}
JSONCodec is the default Codec. It is stateless and safe for concurrent use.
type LocalCachedMapOptions ¶ added in v0.2.13
type LocalCachedMapOptions struct {
// DisableNearCache turns off the in-process cache (every Get hits Redis).
// Use for Java/Go mixed deployments until Redisson binary invalidation is
// implemented — data layer remains wire-compatible.
DisableNearCache bool
// CacheTTL expires local entries after this duration (0 = no local TTL).
CacheTTL time.Duration
// SizeLimit caps local entries (0 = unlimited).
SizeLimit int
}
LocalCachedMapOptions configures near-cache behaviour.
type Logger ¶
Logger is the minimal logging interface used to report background goroutine failures (lock watchdog renewals, delayed-queue migration…).
type MultimapEntry ¶ added in v0.2.13
MultimapEntry is one key/value association returned by Entries.
type PendingEntry ¶ added in v0.2.3
PendingEntry describes an entry delivered but not yet acknowledged.
type RArray ¶ added in v0.2.13
type RArray struct {
// contains filtered or unexported fields
}
RArray is a Redis 8.8+ ARRAY type (ARSET/ARGET/…). Values are codec-encoded like other Redisson structures. Commands missing on older Redis return the server error; tests skip when the ARRAY command family is unavailable.
func (*RArray) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (*RArray) Count ¶ added in v0.2.13
Count returns the number of set (non-empty) slots (ARCOUNT).
func (*RArray) DeleteIndexes ¶ added in v0.2.13
Delete removes values at the given indexes (ARDEL).
func (*RArray) DeleteRange ¶ added in v0.2.13
DeleteRange removes indexes in [start, end] inclusive (ARDELRANGE).
func (*RArray) GetMulti ¶ added in v0.2.13
GetMulti returns values at the given indexes (ARMGET). Missing slots are nil.
func (*RArray) Insert ¶ added in v0.2.13
Insert appends values at the internal cursor (ARINSERT). Returns the last inserted index.
func (*RArray) Length ¶ added in v0.2.13
Length returns max index + 1 (ARLEN), or 0 when the key is absent.
func (*RArray) Name ¶ added in v0.2.13
func (o *RArray) Name() string
Name returns the Redis key name of the object.
func (*RArray) Range ¶ added in v0.2.13
Range returns values in [start, end] inclusive (ARGETRANGE). Unset slots are nil.
func (*RArray) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RArray) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RArray) Set ¶ added in v0.2.13
Set stores value at index (ARSET). Returns the number of newly filled slots.
func (*RArray) SetEntries ¶ added in v0.2.13
SetEntries stores non-contiguous index→value pairs (ARMSET).
type RAtomicDouble ¶
type RAtomicDouble struct {
// contains filtered or unexported fields
}
RAtomicDouble is a distributed atomic double backed by a Redis String holding a plain decimal number (Redisson StringCodec-compatible).
func (*RAtomicDouble) AddAndGet ¶
AddAndGet atomically adds delta (INCRBYFLOAT) and returns the new value.
func (*RAtomicDouble) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RAtomicDouble) CompareAndSet ¶
CompareAndSet sets newVal only when the current value equals expect (numeric comparison; missing key counts as 0).
func (*RAtomicDouble) DecrementAndGet ¶
func (a *RAtomicDouble) DecrementAndGet(ctx context.Context) (float64, error)
DecrementAndGet subtracts 1 atomically.
func (*RAtomicDouble) Get ¶
func (a *RAtomicDouble) Get(ctx context.Context) (float64, error)
Get returns the current value; 0 when the key does not exist.
func (*RAtomicDouble) GetAndAdd ¶ added in v0.2.13
GetAndAdd adds delta and returns the previous value.
func (*RAtomicDouble) GetAndDecrement ¶ added in v0.2.13
func (a *RAtomicDouble) GetAndDecrement(ctx context.Context) (float64, error)
GetAndDecrement returns the previous value then decrements by 1.
func (*RAtomicDouble) GetAndDelete ¶ added in v0.2.13
func (a *RAtomicDouble) GetAndDelete(ctx context.Context) (float64, error)
GetAndDelete removes the key and returns its previous value (0 if absent).
func (*RAtomicDouble) GetAndIncrement ¶ added in v0.2.13
func (a *RAtomicDouble) GetAndIncrement(ctx context.Context) (float64, error)
GetAndIncrement returns the previous value then increments by 1.
func (*RAtomicDouble) GetAndSet ¶ added in v0.2.13
GetAndSet replaces the value and returns the previous one (alias of Set).
func (*RAtomicDouble) IncrementAndGet ¶
func (a *RAtomicDouble) IncrementAndGet(ctx context.Context) (float64, error)
IncrementAndGet adds 1 atomically.
func (*RAtomicDouble) Name ¶
func (o *RAtomicDouble) Name() string
Name returns the Redis key name of the object.
func (*RAtomicDouble) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RAtomicDouble) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RAtomicDouble) SetIfGreater ¶ added in v0.2.13
SetIfGreater sets value when the current value is greater than threshold.
func (*RAtomicDouble) SetIfLess ¶ added in v0.2.13
SetIfLess sets value when the current value is less than threshold.
type RAtomicLong ¶
type RAtomicLong struct {
// contains filtered or unexported fields
}
RAtomicLong is a distributed atomic 64-bit integer backed by a Redis String holding a plain decimal number (Redisson StringCodec format, interoperable without any codec configuration).
Example ¶
package main
import (
"context"
"fmt"
redi "github.com/linkerlin/redi.go"
)
func main() {
client, err := redi.NewClient(redi.DefaultConfig())
if err != nil {
fmt.Println("skip:", err)
return
}
defer client.Close() //nolint:errcheck // example
ctx := context.Background()
_, _ = client.GetKeys().Delete(ctx, "demo:hits")
counter := client.GetAtomicLong("demo:hits")
counter.Set(ctx, 0) //nolint:errcheck // example
n, _ := counter.IncrementAndGet(ctx)
fmt.Println("after inc:", n)
swapped, _ := counter.CompareAndSet(ctx, 1, 100)
fmt.Println("cas 1->100:", swapped)
}
Output: after inc: 1 cas 1->100: true
func (*RAtomicLong) AddAndGet ¶
AddAndGet atomically adds delta to the value and returns the new value.
func (*RAtomicLong) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RAtomicLong) CompareAndDelete ¶ added in v0.2.13
CompareAndDelete deletes the value only when it equals expect.
func (*RAtomicLong) CompareAndSet ¶
CompareAndSet atomically sets the value to newVal only when the current value equals expect. A missing key counts as 0.
func (*RAtomicLong) DecrementAndGet ¶
func (a *RAtomicLong) DecrementAndGet(ctx context.Context) (int64, error)
DecrementAndGet atomically decrements the value by 1 and returns the new value.
func (*RAtomicLong) Get ¶
func (a *RAtomicLong) Get(ctx context.Context) (int64, error)
Get returns the current value; 0 when the key does not exist (Redisson semantics).
func (*RAtomicLong) GetAndDecrement ¶ added in v0.2.13
func (a *RAtomicLong) GetAndDecrement(ctx context.Context) (int64, error)
GetAndDecrement returns the previous value then decrements by 1.
func (*RAtomicLong) GetAndDelete ¶ added in v0.2.13
func (a *RAtomicLong) GetAndDelete(ctx context.Context) (int64, error)
GetAndDelete removes the key and returns its previous value (0 if absent).
func (*RAtomicLong) GetAndIncrement ¶ added in v0.2.13
func (a *RAtomicLong) GetAndIncrement(ctx context.Context) (int64, error)
GetAndIncrement returns the previous value then increments by 1.
func (*RAtomicLong) GetAndSet ¶ added in v0.2.13
GetAndSet replaces the value and returns the previous one (alias of Set).
func (*RAtomicLong) IncrementAndGet ¶
func (a *RAtomicLong) IncrementAndGet(ctx context.Context) (int64, error)
IncrementAndGet atomically increments the value by 1 and returns the new value.
func (*RAtomicLong) Name ¶
func (o *RAtomicLong) Name() string
Name returns the Redis key name of the object.
func (*RAtomicLong) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RAtomicLong) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RAtomicLong) SetIfGreater ¶ added in v0.2.13
SetIfGreater sets value when the current value is greater than threshold.
func (*RAtomicLong) SetIfLess ¶ added in v0.2.13
SetIfLess sets value when the current value is less than threshold.
type RBatch ¶
type RBatch struct {
// contains filtered or unexported fields
}
RBatch queues structure operations into a single pipeline; Execute flushes them all in one round-trip (the classic ~10x latency win over sequential commands).
The structures returned by the Get* factories below are bound to the pipeline: write methods (Put/Add/Offer/Set/…) queue commands and return immediately. Read methods return zero values until Execute has run — use a normal client structure to read results back (Redisson has the same constraint: batch reads need its Async API).
Example ¶
package main
import (
"context"
"fmt"
"log"
redi "github.com/linkerlin/redi.go"
)
func main() {
client, err := redi.NewClient(redi.DefaultConfig())
if err != nil {
fmt.Println("skip:", err)
return
}
defer client.Close() //nolint:errcheck // example
ctx := context.Background()
// Queue writes into one pipeline, flush in a single round-trip.
_, _ = client.GetKeys().Delete(ctx, "demo:batch")
batch := client.NewBatch()
m := batch.GetMap("demo:batch")
for i := 0; i < 100; i++ {
_ = m.Put(ctx, fmt.Sprint(i), i)
}
if err := batch.Execute(ctx); err != nil {
log.Fatal(err)
}
sz, _ := client.GetMap("demo:batch").Size(ctx)
fmt.Println("batched size:", sz)
_ = client.GetMap("demo:batch").Clear(ctx)
}
Output: batched size: 100
func (*RBatch) Discard ¶
func (b *RBatch) Discard()
Discard drops the queued commands without executing them.
func (*RBatch) GetAtomicDouble ¶
func (b *RBatch) GetAtomicDouble(name string) *RAtomicDouble
GetAtomicDouble returns a pipeline-bound double counter.
func (*RBatch) GetAtomicLong ¶
func (b *RBatch) GetAtomicLong(name string) *RAtomicLong
GetAtomicLong returns a pipeline-bound counter.
func (*RBatch) GetScoredSortedSet ¶
func (b *RBatch) GetScoredSortedSet(name string) *RScoredSortedSet
GetScoredSortedSet returns a pipeline-bound sorted set.
type RBinaryStream ¶ added in v0.2.13
type RBinaryStream struct {
// contains filtered or unexported fields
}
RBinaryStream stores raw bytes in a Redis String. Unlike RBucket, values bypass the configured Codec to match Redisson's ByteArrayCodec wire format.
func (*RBinaryStream) Append ¶ added in v0.2.13
Append appends raw bytes and returns the resulting stream size.
func (*RBinaryStream) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (*RBinaryStream) Get ¶ added in v0.2.13
func (s *RBinaryStream) Get(ctx context.Context) ([]byte, error)
Get returns all bytes, or (nil, nil) when the stream is absent.
func (*RBinaryStream) GetChannel ¶ added in v0.2.13
func (s *RBinaryStream) GetChannel(ctx context.Context) *RBinaryStreamChannel
GetChannel returns a seekable raw-byte channel starting at position 0. The returned channel is not safe for concurrent use.
func (*RBinaryStream) GetInputStream ¶ added in v0.2.13
func (s *RBinaryStream) GetInputStream(ctx context.Context) *RBinaryStreamReader
GetInputStream returns a sequential raw-byte reader starting at position 0. The returned reader is not safe for concurrent use.
func (*RBinaryStream) GetOutputStream ¶ added in v0.2.13
func (s *RBinaryStream) GetOutputStream(ctx context.Context) *RBinaryStreamWriter
GetOutputStream returns an append-only raw-byte writer. The returned writer is not safe for concurrent use.
func (*RBinaryStream) Name ¶ added in v0.2.13
func (o *RBinaryStream) Name() string
Name returns the Redis key name of the object.
func (*RBinaryStream) Read ¶ added in v0.2.13
Read returns length bytes starting at offset. A length of -1 reads through the end of the stream.
func (*RBinaryStream) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RBinaryStream) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RBinaryStream) Set ¶ added in v0.2.13
func (s *RBinaryStream) Set(ctx context.Context, data []byte) error
Set replaces the stream with raw bytes.
func (*RBinaryStream) Size ¶ added in v0.2.13
func (s *RBinaryStream) Size(ctx context.Context) (int64, error)
Size returns the stream size in bytes.
func (*RBinaryStream) Truncate ¶ added in v0.2.13
func (s *RBinaryStream) Truncate(ctx context.Context, size int64) error
Truncate shrinks the stream to size bytes. As in Redisson 4.6.1, growing is a no-op, size zero deletes the key, and a non-zero shrink clears its TTL.
type RBinaryStreamChannel ¶ added in v0.2.13
type RBinaryStreamChannel struct {
// contains filtered or unexported fields
}
RBinaryStreamChannel is a seekable read/write view over an RBinaryStream. Close is intentionally a no-op, matching Redisson's channel.
func (*RBinaryStreamChannel) Close ¶ added in v0.2.13
func (c *RBinaryStreamChannel) Close() error
Close is a no-op because the channel doesn't own a Redis connection.
func (*RBinaryStreamChannel) IsOpen ¶ added in v0.2.13
func (c *RBinaryStreamChannel) IsOpen() bool
IsOpen always returns true, matching Redisson's no-op channel Close.
func (*RBinaryStreamChannel) Position ¶ added in v0.2.13
func (c *RBinaryStreamChannel) Position() int64
Position returns the current channel position.
func (*RBinaryStreamChannel) Read ¶ added in v0.2.13
func (c *RBinaryStreamChannel) Read(p []byte) (int, error)
Read reads from the current position and advances by the bytes returned.
func (*RBinaryStreamChannel) Seek ¶ added in v0.2.13
func (c *RBinaryStreamChannel) Seek(offset int64, whence int) (int64, error)
Seek sets the channel position using standard io.Seeker semantics.
func (*RBinaryStreamChannel) Size ¶ added in v0.2.13
func (c *RBinaryStreamChannel) Size() (int64, error)
Size returns the underlying stream size.
func (*RBinaryStreamChannel) Truncate ¶ added in v0.2.13
func (c *RBinaryStreamChannel) Truncate(size int64) error
Truncate shrinks the underlying stream without changing the channel position.
type RBinaryStreamReader ¶ added in v0.2.13
type RBinaryStreamReader struct {
// contains filtered or unexported fields
}
RBinaryStreamReader is the Go counterpart of Redisson's InputStream view.
type RBinaryStreamWriter ¶ added in v0.2.13
type RBinaryStreamWriter struct {
// contains filtered or unexported fields
}
RBinaryStreamWriter is the Go counterpart of Redisson's append-only OutputStream view.
type RBitSet ¶ added in v0.2.2
type RBitSet struct {
// contains filtered or unexported fields
}
RBitSet is a distributed bitset over a Redis bitmap. Bit indexes are the raw Redis GETBIT/SETBIT indexes — identical to Java Redisson's RedissonBitSet (verified from its toByteArray: bit i maps to byte[i/8] bit (7-i%8), i.e. native MSB-first Redis numbering; no reversal anywhere).
func (*RBitSet) And ¶ added in v0.2.2
And / Or / Xor apply BITOP with other bitsets, storing into this one.
func (*RBitSet) AndOr ¶ added in v0.2.13
AndOr stores bits set in this bitset and in at least one other bitset.
func (*RBitSet) BitFieldGet ¶ added in v0.2.13
func (b *RBitSet) BitFieldGet(ctx context.Context, signed bool, width int, offset int64) (int64, error)
BitFieldGet reads a signed or unsigned integer field.
func (*RBitSet) BitFieldIncrBy ¶ added in v0.2.13
func (b *RBitSet) BitFieldIncrBy( ctx context.Context, signed bool, width int, offset, increment int64, ) (int64, error)
BitFieldIncrBy increments a field and returns its new value (WRAP overflow).
func (*RBitSet) BitFieldSet ¶ added in v0.2.13
func (b *RBitSet) BitFieldSet( ctx context.Context, signed bool, width int, offset, value int64, ) (int64, error)
BitFieldSet writes a field and returns its previous value.
func (*RBitSet) Cardinality ¶ added in v0.2.2
Cardinality returns the number of set bits (BITCOUNT).
func (*RBitSet) ClearExpire ¶ added in v0.2.2
ClearExpire removes the TTL (key becomes persistent).
func (*RBitSet) ClearRange ¶ added in v0.2.13
ClearRange clears every bit in the inclusive range [from, toInclusive].
func (*RBitSet) Diff ¶ added in v0.2.13
Diff stores bits set in this bitset and absent from every other bitset. It returns the stored bitmap length in bytes.
func (*RBitSet) FromByteArray ¶ added in v0.2.2
FromByteArray replaces the bitset with raw bytes (MSB-first, matching Java).
func (*RBitSet) Length ¶ added in v0.2.2
Length returns the highest set bit index + 1 (Java BitSet semantics; 0 when empty).
func (*RBitSet) Name ¶ added in v0.2.2
func (o *RBitSet) Name() string
Name returns the Redis key name of the object.
func (*RBitSet) Not ¶ added in v0.2.2
Not applies bitwise NOT in place. An optional source name preserves the previous Not(ctx, otherName) form.
func (*RBitSet) RemainTTL ¶ added in v0.2.2
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RBitSet) Rename ¶ added in v0.2.2
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RBitSet) SetExclusive ¶ added in v0.2.13
SetExclusive stores bits set in exactly one source bitset.
func (*RBitSet) SetMany ¶ added in v0.2.13
SetMany sets all indexes to value in one BITFIELD command.
func (*RBitSet) SetRange ¶ added in v0.2.13
SetRange sets every bit in the inclusive range [from, toInclusive].
func (*RBitSet) Size ¶ added in v0.2.13
Size returns the logical bit length (highest set bit index + 1).
func (*RBitSet) ToByteArray ¶ added in v0.2.2
ToByteArray returns the raw bitmap bytes (MSB-first, matching Java).
type RBlockingDeque ¶
type RBlockingDeque struct {
*RDeque
}
RBlockingDeque is an RDeque with blocking consumption from both ends.
func (RBlockingDeque) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (RBlockingDeque) Name ¶
func (o RBlockingDeque) Name() string
Name returns the Redis key name of the object.
func (*RBlockingDeque) PollFirstWithTimeout ¶
func (d *RBlockingDeque) PollFirstWithTimeout(ctx context.Context, timeout time.Duration) (any, error)
PollFirstWithTimeout blocks up to timeout for a head element.
func (*RBlockingDeque) PollLastWithTimeout ¶
func (d *RBlockingDeque) PollLastWithTimeout(ctx context.Context, timeout time.Duration) (any, error)
PollLastWithTimeout blocks up to timeout for a tail element.
func (RBlockingDeque) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (RBlockingDeque) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RBlockingDeque) TakeFirst ¶
func (d *RBlockingDeque) TakeFirst(ctx context.Context) (any, error)
TakeFirst blocks until an element is available at the head.
func (*RBlockingDeque) TakeLast ¶
func (d *RBlockingDeque) TakeLast(ctx context.Context) (any, error)
TakeLast blocks until an element is available at the tail.
type RBlockingQueue ¶
type RBlockingQueue struct {
*RQueue
}
RBlockingQueue is an RQueue with blocking consumption (BLPOP).
func (RBlockingQueue) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (RBlockingQueue) Name ¶
func (o RBlockingQueue) Name() string
Name returns the Redis key name of the object.
func (*RBlockingQueue) PollFromAny ¶ added in v0.2.13
func (q *RBlockingQueue) PollFromAny( ctx context.Context, timeout time.Duration, otherNames ...string, ) (any, error)
PollFromAny blocks for a head element from this queue or any named queue. This queue has priority when multiple queues already contain elements.
func (*RBlockingQueue) PollLastAndOfferFirstTo ¶ added in v0.2.13
func (q *RBlockingQueue) PollLastAndOfferFirstTo( ctx context.Context, dest string, timeout time.Duration, ) (any, error)
PollLastAndOfferFirstTo atomically moves the tail element to the head of dest, blocking up to timeout while this queue is empty.
func (*RBlockingQueue) PollWithTimeout ¶
PollWithTimeout blocks up to timeout for an element. Sub-second timeouts are rounded up to 1s (BLPOP granularity).
func (RBlockingQueue) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (RBlockingQueue) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RBlockingQueue) Take ¶
func (q *RBlockingQueue) Take(ctx context.Context) (any, error)
Take blocks until an element is available or ctx is cancelled.
type RBloomFilter ¶
type RBloomFilter struct {
// contains filtered or unexported fields
}
RBloomFilter is a distributed bloom filter, wire-compatible with Redisson: HighwayHash-128 with Redisson's fixed key over the codec-encoded element, bitmap stored at the raw name, config HASH at {name}:config.
func (*RBloomFilter) AddAll ¶ added in v0.2.13
AddAll adds elements and returns how many set at least one previously clear bit, matching Redisson's collection add count.
func (*RBloomFilter) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RBloomFilter) Contains ¶
Contains reports whether element may have been added (false = definitely not).
func (*RBloomFilter) ContainsAll ¶ added in v0.2.13
ContainsAll returns how many supplied elements may be present.
func (*RBloomFilter) Count ¶
func (f *RBloomFilter) Count(ctx context.Context) (int64, error)
Count estimates the number of distinct elements added.
func (*RBloomFilter) Delete ¶
func (f *RBloomFilter) Delete(ctx context.Context) error
Delete removes the bitmap and its config.
func (*RBloomFilter) ExpectedInsertions ¶
func (f *RBloomFilter) ExpectedInsertions(ctx context.Context) (int64, error)
ExpectedInsertions returns the configured expected insertions.
func (*RBloomFilter) FalseProbability ¶
func (f *RBloomFilter) FalseProbability(ctx context.Context) (float64, error)
FalseProbability returns the configured false positive probability.
func (*RBloomFilter) HashIterations ¶
func (f *RBloomFilter) HashIterations(ctx context.Context) (int64, error)
HashIterations returns the number of hash functions used.
func (*RBloomFilter) Name ¶
func (o *RBloomFilter) Name() string
Name returns the Redis key name of the object.
func (*RBloomFilter) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RBloomFilter) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RBloomFilter) Size ¶
func (f *RBloomFilter) Size(ctx context.Context) (int64, error)
Size returns the bitmap size in bits.
type RBloomFilterNative ¶ added in v0.2.13
type RBloomFilterNative struct {
// contains filtered or unexported fields
}
RBloomFilterNative wraps Redis BF.* commands (RedissonBloomFilterNative). Elements are codec-encoded before insertion so JsonJacksonCodec clients match.
func (*RBloomFilterNative) AddAll ¶ added in v0.2.13
AddAll inserts many elements; returns per-element "newly set" flags.
func (*RBloomFilterNative) Card ¶ added in v0.2.13
func (f *RBloomFilterNative) Card(ctx context.Context) (int64, error)
Card returns BF.CARD (approximate item count).
func (*RBloomFilterNative) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (*RBloomFilterNative) Contains ¶ added in v0.2.13
Contains reports whether element may be present.
func (*RBloomFilterNative) ContainsAll ¶ added in v0.2.13
ContainsAll returns per-element membership guesses.
func (*RBloomFilterNative) Name ¶ added in v0.2.13
func (o *RBloomFilterNative) Name() string
Name returns the Redis key name of the object.
func (*RBloomFilterNative) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RBloomFilterNative) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
type RBoundedBlockingQueue ¶ added in v0.2.13
type RBoundedBlockingQueue struct {
*RQueue
// contains filtered or unexported fields
}
RBoundedBlockingQueue is Redisson's capacity-bounded FIFO queue. Values live in the queue LIST and available capacity in redisson_bqs:{name}.
func (*RBoundedBlockingQueue) Clear ¶ added in v0.2.13
func (q *RBoundedBlockingQueue) Clear(ctx context.Context) error
Clear removes all queued values and restores their capacity.
func (RBoundedBlockingQueue) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (*RBoundedBlockingQueue) Delete ¶ added in v0.2.13
func (q *RBoundedBlockingQueue) Delete(ctx context.Context) error
Delete removes both the queue and its capacity companion.
func (RBoundedBlockingQueue) Name ¶ added in v0.2.13
func (o RBoundedBlockingQueue) Name() string
Name returns the Redis key name of the object.
func (*RBoundedBlockingQueue) Offer ¶ added in v0.2.13
Offer adds value when capacity is available and returns false when full.
func (*RBoundedBlockingQueue) OfferWait ¶ added in v0.2.13
func (q *RBoundedBlockingQueue) OfferWait( ctx context.Context, value any, wait time.Duration, ) (bool, error)
OfferWait waits up to wait for capacity and then atomically appends value.
func (*RBoundedBlockingQueue) Poll ¶ added in v0.2.13
func (q *RBoundedBlockingQueue) Poll(ctx context.Context) (any, error)
Poll removes the head and releases one capacity permit.
func (*RBoundedBlockingQueue) PollInto ¶ added in v0.2.13
PollInto removes the head and decodes it into target.
func (*RBoundedBlockingQueue) Put ¶ added in v0.2.13
func (q *RBoundedBlockingQueue) Put(ctx context.Context, value any) error
Put blocks until value is appended or ctx is cancelled.
func (RBoundedBlockingQueue) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RBoundedBlockingQueue) RemainingCapacity ¶ added in v0.2.13
func (q *RBoundedBlockingQueue) RemainingCapacity(ctx context.Context) (int64, error)
RemainingCapacity returns the number of values that can be added.
func (RBoundedBlockingQueue) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RBoundedBlockingQueue) Take ¶ added in v0.2.13
Take blocks until an element is available or timeout elapses, then releases one capacity permit. A zero timeout blocks until ctx is cancelled.
func (RBoundedBlockingQueue) Touch ¶ added in v0.2.13
Touch updates the last-access time of the key.
func (*RBoundedBlockingQueue) TrySetCapacity ¶ added in v0.2.13
func (q *RBoundedBlockingQueue) TrySetCapacity( ctx context.Context, capacity int64, ) (bool, error)
TrySetCapacity initializes capacity once. Later calls leave it unchanged.
type RBucket ¶
type RBucket struct {
// contains filtered or unexported fields
}
RBucket is a distributed object holder backed by a Redis String. The whole value is codec (JSON) encoded, Redisson-compatible.
func (*RBucket) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RBucket) CompareAndDelete ¶ added in v0.2.13
CompareAndDelete atomically deletes the value when it equals expect.
func (*RBucket) CompareAndSet ¶
CompareAndSet atomically replaces the value when it equals expect. expect == nil means "key must be absent".
func (*RBucket) GetAndDelete ¶
GetAndDelete removes and returns the value.
func (*RBucket) GetAndSetWithTTL ¶ added in v0.2.13
GetAndSetWithTTL replaces the value with a TTL and returns the previous one.
func (*RBucket) GetInto ¶
GetInto decodes the value into the pointer target. Returns false when absent.
Example ¶
package main
import (
"context"
"fmt"
redi "github.com/linkerlin/redi.go"
)
func main() {
client, err := redi.NewClient(redi.DefaultConfig())
if err != nil {
fmt.Println("skip:", err)
return
}
defer client.Close() //nolint:errcheck // example
ctx := context.Background()
_, _ = client.GetKeys().Delete(ctx, "demo:bucket")
type cfg struct {
Host string `json:"host"`
Port int `json:"port"`
}
b := client.GetBucket("demo:bucket")
_ = b.Set(ctx, cfg{Host: "redis", Port: 6379})
var out cfg
ok, _ := b.GetInto(ctx, &out)
fmt.Println(ok, out.Host, out.Port)
}
Output: true redis 6379
func (*RBucket) Name ¶
func (o *RBucket) Name() string
Name returns the Redis key name of the object.
func (*RBucket) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RBucket) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RBucket) SetAndKeepTTL ¶ added in v0.2.13
SetAndKeepTTL replaces the value without changing its existing TTL.
func (*RBucket) SetIfExists ¶
SetIfExists sets the value only when the key exists (SET XX).
func (*RBucket) SetIfExistsWithTTL ¶ added in v0.2.13
func (b *RBucket) SetIfExistsWithTTL(ctx context.Context, value any, ttl time.Duration) (bool, error)
SetIfExistsWithTTL sets the value with a TTL only when the key exists.
func (*RBucket) SetWithTTL ¶
SetWithTTL replaces the value with millisecond-precision TTL.
func (*RBucket) TrySetWithTTL ¶ added in v0.2.13
TrySetWithTTL sets the value with a TTL only when absent (SET NX).
type RBuckets ¶
type RBuckets struct {
// contains filtered or unexported fields
}
RBuckets performs batch operations across multiple bucket keys (MGET / MSET / MSETNX), values codec-encoded like RBucket.
func (*RBuckets) Set ¶
Set stores the mapping (MSET), optionally with a millisecond TTL applied to every key (pipelined PSETEX when ttl > 0).
func (*RBuckets) SetIfAllKeysAbsent ¶ added in v0.2.13
SetIfAllKeysAbsent stores all values only when no key exists.
func (*RBuckets) SetIfAllKeysExist ¶ added in v0.2.13
SetIfAllKeysExist stores all values only when every key already exists.
type RCircularBuffer ¶ added in v0.2.13
type RCircularBuffer struct {
// contains filtered or unexported fields
}
RCircularBuffer is a Redis 8.8+ ARRAY ring with stable slot indexes (RedissonCircularBuffer). Distinct from LIST-backed RRingBuffer.
func (*RCircularBuffer) Add ¶ added in v0.2.13
func (b *RCircularBuffer) Add(ctx context.Context, value any) error
Add appends value (ARRING).
func (*RCircularBuffer) AddAll ¶ added in v0.2.13
func (b *RCircularBuffer) AddAll(ctx context.Context, values ...any) error
AddAll appends values.
func (*RCircularBuffer) Capacity ¶ added in v0.2.13
func (b *RCircularBuffer) Capacity(ctx context.Context) (int, error)
Capacity returns configured capacity (0 when unset).
func (*RCircularBuffer) Clear ¶ added in v0.2.13
func (b *RCircularBuffer) Clear(ctx context.Context) error
Clear deletes data and capacity metadata.
func (*RCircularBuffer) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (*RCircularBuffer) Name ¶ added in v0.2.13
func (o *RCircularBuffer) Name() string
Name returns the Redis key name of the object.
func (*RCircularBuffer) ReadAll ¶ added in v0.2.13
func (b *RCircularBuffer) ReadAll(ctx context.Context) ([]any, error)
ReadAll returns values in temporal order via ARLASTITEMS when available, else falls back to scanning slots 0..capacity-1.
func (*RCircularBuffer) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RCircularBuffer) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RCircularBuffer) SetCapacity ¶ added in v0.2.13
func (b *RCircularBuffer) SetCapacity(ctx context.Context, capacity int) error
SetCapacity overwrites capacity metadata (applied on next write).
func (*RCircularBuffer) Size ¶ added in v0.2.13
func (b *RCircularBuffer) Size(ctx context.Context) (int64, error)
Size returns ARLEN.
func (*RCircularBuffer) TrySetCapacity ¶ added in v0.2.13
TrySetCapacity sets capacity only when unset.
type RClientSideCaching ¶ added in v0.2.13
type RClientSideCaching struct {
// contains filtered or unexported fields
}
RClientSideCaching mirrors Redisson getClientSideCaching: factories return structures whose Redis traffic may be served from go-redis RESP3 CLIENT TRACKING cache.
Two construction paths:
- Config.ClientSideCaching at NewClient — CSC on the shared pool; GetClientSideCaching() is a zero-cost facade over that Client.
- GetClientSideCachingWithOptions — Redisson-shaped runtime scope: a dedicated redis.Client (Protocol 3 + ClientSideCacheConfig) owned by this facade; Destroy() closes it.
Still PARTIAL vs Java: no in-process read-proxy with evictionPolicy LRU/LFU/SOFT/WEAK over method arguments; go-redis owns the reply cache.
Topology: Config.ClientSideCaching and GetClientSideCachingWithOptions require ModeSingle + DB 0 + RESP3. Cluster/Sentinel return ErrClientSideCachingUnavailable for the owned-options path; shared Config CSC is ignored outside ModeSingle.
func (*RClientSideCaching) Destroy ¶ added in v0.2.13
func (csc *RClientSideCaching) Destroy() error
Destroy closes an owned CSC client (GetClientSideCachingWithOptions). Shared-pool facades are a no-op (pool lives with Client.Close).
func (*RClientSideCaching) Enabled ¶ added in v0.2.13
func (csc *RClientSideCaching) Enabled() bool
Enabled reports whether this facade's Client has CSC configured.
func (*RClientSideCaching) GetAtomicDouble ¶ added in v0.2.13
func (csc *RClientSideCaching) GetAtomicDouble(name string) *RAtomicDouble
GetAtomicDouble forwards to the CSC-backed Client.
func (*RClientSideCaching) GetAtomicLong ¶ added in v0.2.13
func (csc *RClientSideCaching) GetAtomicLong(name string) *RAtomicLong
GetAtomicLong forwards to the CSC-backed Client.
func (*RClientSideCaching) GetBitSet ¶ added in v0.2.13
func (csc *RClientSideCaching) GetBitSet(name string) *RBitSet
GetBitSet forwards to the CSC-backed Client.
func (*RClientSideCaching) GetBlockingDeque ¶ added in v0.2.13
func (csc *RClientSideCaching) GetBlockingDeque(name string) *RBlockingDeque
GetBlockingDeque forwards to the CSC-backed Client.
func (*RClientSideCaching) GetBlockingQueue ¶ added in v0.2.13
func (csc *RClientSideCaching) GetBlockingQueue(name string) *RBlockingQueue
GetBlockingQueue forwards to the CSC-backed Client.
func (*RClientSideCaching) GetBucket ¶ added in v0.2.13
func (csc *RClientSideCaching) GetBucket(name string) *RBucket
GetBucket forwards to the CSC-backed Client.
func (*RClientSideCaching) GetDeque ¶ added in v0.2.13
func (csc *RClientSideCaching) GetDeque(name string) *RDeque
GetDeque forwards to the CSC-backed Client.
func (*RClientSideCaching) GetGeo ¶ added in v0.2.13
func (csc *RClientSideCaching) GetGeo(name string) *RGeo
GetGeo forwards to the CSC-backed Client.
func (*RClientSideCaching) GetHyperLogLog ¶ added in v0.2.13
func (csc *RClientSideCaching) GetHyperLogLog(name string) *RHyperLogLog
GetHyperLogLog forwards to the CSC-backed Client.
func (*RClientSideCaching) GetList ¶ added in v0.2.13
func (csc *RClientSideCaching) GetList(name string) *RList
GetList forwards to the CSC-backed Client.
func (*RClientSideCaching) GetMap ¶ added in v0.2.13
func (csc *RClientSideCaching) GetMap(name string) *RMap
GetMap forwards to the CSC-backed Client.
func (*RClientSideCaching) GetQueue ¶ added in v0.2.13
func (csc *RClientSideCaching) GetQueue(name string) *RQueue
GetQueue forwards to the CSC-backed Client.
func (*RClientSideCaching) GetScoredSortedSet ¶ added in v0.2.13
func (csc *RClientSideCaching) GetScoredSortedSet(name string) *RScoredSortedSet
GetScoredSortedSet forwards to the CSC-backed Client.
func (*RClientSideCaching) GetSet ¶ added in v0.2.13
func (csc *RClientSideCaching) GetSet(name string) *RSet
GetSet forwards to the CSC-backed Client.
func (*RClientSideCaching) GetStream ¶ added in v0.2.13
func (csc *RClientSideCaching) GetStream(name string) *RStream
GetStream forwards to the CSC-backed Client.
func (*RClientSideCaching) Owned ¶ added in v0.2.13
func (csc *RClientSideCaching) Owned() bool
Owned reports whether Destroy closes a dedicated CSC client.
type RCountDownLatch ¶
type RCountDownLatch struct {
// contains filtered or unexported fields
}
RCountDownLatch is a distributed countdown latch backed by a Redis String counter, Redisson wire-compatible: channel redisson_countdownlatch__channel__{name} receives message 0 when the count reaches zero.
func (*RCountDownLatch) Await ¶
Await blocks until the count reaches zero. A non-positive timeout waits indefinitely. Returns false on timeout.
func (*RCountDownLatch) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RCountDownLatch) CountDown ¶
func (l *RCountDownLatch) CountDown(ctx context.Context) error
CountDown decrements the count, deleting the key at zero and publishing the wake-up message.
func (*RCountDownLatch) GetCount ¶
func (l *RCountDownLatch) GetCount(ctx context.Context) (int64, error)
GetCount returns the current count (0 when the latch is open/absent).
func (*RCountDownLatch) Name ¶
func (o *RCountDownLatch) Name() string
Name returns the Redis key name of the object.
func (*RCountDownLatch) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RCountDownLatch) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RCountDownLatch) TrySetCount ¶
TrySetCount initializes the latch count only when it does not exist.
type RCuckooFilter ¶ added in v0.2.13
type RCuckooFilter struct {
// contains filtered or unexported fields
}
RCuckooFilter wraps Redis CF.* commands.
func (*RCuckooFilter) AddIfAbsent ¶ added in v0.2.13
AddIfAbsent inserts only when absent (CF.ADDNX).
func (*RCuckooFilter) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (*RCuckooFilter) Name ¶ added in v0.2.13
func (o *RCuckooFilter) Name() string
Name returns the Redis key name of the object.
func (*RCuckooFilter) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RCuckooFilter) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
type RDelayedQueue ¶
type RDelayedQueue struct {
// contains filtered or unexported fields
}
RDelayedQueue offers delayed delivery, wire-compatible with Redisson's RedissonDelayedQueue (verified against 4.6.1):
ZSET redisson_delay_queue_timeout:{name} deadline index:
member = struct.pack('Bc0Lc0', randomIdLen=8, randomId, encLen, encodedValue)
LIST redisson_delay_queue:{name} the same packed members (ordering +
lrem support); expired members are unpacked and RPUSHed onto {name}
LIST {name} the target queue consumers poll
PUB redisson_delay_queue_channel:{name} wake-up channel (head startTime)
A background goroutine migrates expired members (Redis TIME clock).
func (*RDelayedQueue) Clear ¶ added in v0.2.13
func (q *RDelayedQueue) Clear(ctx context.Context) error
Clear removes pending delayed elements without clearing the target queue.
func (*RDelayedQueue) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RDelayedQueue) Contains ¶ added in v0.2.13
Contains reports whether a pending delayed element equals element.
func (*RDelayedQueue) DelayedSize ¶
func (q *RDelayedQueue) DelayedSize(ctx context.Context) (int64, error)
DelayedSize returns the number of elements still waiting.
func (*RDelayedQueue) Delete ¶
func (q *RDelayedQueue) Delete(ctx context.Context) error
Delete removes the target queue and both internal keys.
func (*RDelayedQueue) MigrateExpired ¶
func (q *RDelayedQueue) MigrateExpired(ctx context.Context) (int64, error)
MigrateExpired moves all due members onto the target queue.
func (*RDelayedQueue) Name ¶
func (o *RDelayedQueue) Name() string
Name returns the Redis key name of the object.
func (*RDelayedQueue) Peek ¶
func (q *RDelayedQueue) Peek(ctx context.Context) (any, error)
Peek returns the head of the ready queue without removing it.
func (*RDelayedQueue) Poll ¶
func (q *RDelayedQueue) Poll(ctx context.Context) (any, error)
Poll removes and returns the head of the ready queue (nil when empty).
func (*RDelayedQueue) ReadAll ¶ added in v0.2.13
func (q *RDelayedQueue) ReadAll(ctx context.Context) ([]any, error)
ReadAll returns all pending delayed elements in insertion order.
func (*RDelayedQueue) ReadySize ¶
func (q *RDelayedQueue) ReadySize(ctx context.Context) (int64, error)
ReadySize returns the number of immediately available elements.
func (*RDelayedQueue) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RDelayedQueue) Remove ¶ added in v0.2.13
Remove deletes one matching pending delayed element from both indexes.
func (*RDelayedQueue) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RDelayedQueue) Size ¶
func (q *RDelayedQueue) Size(ctx context.Context) (int64, error)
Size returns ready + delayed counts.
type RDeque ¶
type RDeque struct {
// contains filtered or unexported fields
}
RDeque is a distributed double-ended queue backed by a Redis List.
func (*RDeque) AddFirstIfExists ¶ added in v0.2.13
AddFirstIfExists pushes values at the head only when the deque exists and returns the resulting length.
func (*RDeque) AddLastIfExists ¶ added in v0.2.13
AddLastIfExists pushes values at the tail only when the deque exists and returns the resulting length.
func (*RDeque) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RDeque) PeekFirstInto ¶ added in v0.2.13
PeekFirstInto decodes the head into target without removing it. Returns false when the deque is empty.
func (*RDeque) PeekLastInto ¶ added in v0.2.13
PeekLastInto decodes the tail into target without removing it. Returns false when the deque is empty.
func (*RDeque) ReadAll ¶ added in v0.2.13
ReadAll returns all elements from head to tail without removing them.
func (*RDeque) RemoveFirst ¶
RemoveFirst pops the head element. Returns (nil, nil) when empty.
func (*RDeque) RemoveFirstInto ¶ added in v0.2.13
RemoveFirstInto pops the head and decodes it into target. Returns false when the deque is empty.
func (*RDeque) RemoveLast ¶
RemoveLast pops the tail element. Returns (nil, nil) when empty.
func (*RDeque) RemoveLastInto ¶ added in v0.2.13
RemoveLastInto pops the tail and decodes it into target. Returns false when the deque is empty.
func (*RDeque) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
type RDoubleAdder ¶ added in v0.2.8
type RDoubleAdder struct {
// contains filtered or unexported fields
}
RDoubleAdder is the double variant of RLongAdder.
func (*RDoubleAdder) Add ¶ added in v0.2.8
func (a *RDoubleAdder) Add(x float64)
Add adds x to the local buffer.
func (*RDoubleAdder) Decrement ¶ added in v0.2.8
func (a *RDoubleAdder) Decrement()
Decrement subtracts 1.
func (*RDoubleAdder) Destroy ¶ added in v0.2.8
func (a *RDoubleAdder) Destroy()
Destroy unsubscribes this instance.
func (*RDoubleAdder) Increment ¶ added in v0.2.8
func (a *RDoubleAdder) Increment()
Increment adds 1.
type RFairLock ¶ added in v0.2.13
type RFairLock struct {
*RLock
// contains filtered or unexported fields
}
RFairLock is Redisson's FIFO, re-entrant distributed lock. The lock HASH uses the raw name; waiters use redisson_lock_queue:{name} (LIST) and redisson_lock_timeout:{name} (ZSET).
func (RFairLock) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (*RFairLock) ForceUnlock ¶ added in v0.2.13
ForceUnlock deletes the lock regardless of owner and wakes the queue head.
func (*RFairLock) HoldCount ¶ added in v0.2.13
HoldCount returns the re-entrancy count held by clientID.
func (*RFairLock) Lock ¶ added in v0.2.13
Lock acquires the lock in FIFO order, blocking until success or ctx cancellation.
func (RFairLock) Name ¶ added in v0.2.13
func (o RFairLock) Name() string
Name returns the Redis key name of the object.
func (RFairLock) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RFairLock) RemainTimeToLive ¶ added in v0.2.13
RemainTimeToLive returns the remaining lock lease.
func (RFairLock) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RFairLock) TryLock ¶ added in v0.2.13
TryLock attempts one acquisition without joining the wait queue.
func (*RFairLock) TryLockWait ¶ added in v0.2.13
func (l *RFairLock) TryLockWait( ctx context.Context, clientID string, wait, ttl time.Duration, ) (bool, error)
TryLockWait joins the FIFO queue and waits up to wait for the lock.
type RFencedLock ¶ added in v0.2.10
type RFencedLock struct {
*RLock
// contains filtered or unexported fields
}
RFencedLock is a re-entrant distributed lock whose every acquisition increments a fencing token, wire-compatible with Redisson's RedissonFencedLock:
HASH {name} holder counts (same as RLock)
STRING redisson_lock_token:{name} monotonic fencing token (INCR per
acquisition, INCLUDING re-entries)
The guarded service should reject operations carrying a token smaller than the last seen one (the classic fencing answer to lock expiry).
func (RFencedLock) ClearExpire ¶ added in v0.2.10
ClearExpire removes the TTL (key becomes persistent).
func (*RFencedLock) GetToken ¶ added in v0.2.10
func (l *RFencedLock) GetToken(ctx context.Context) (int64, error)
GetToken returns the current fencing token (0 when never acquired).
func (*RFencedLock) LockAndGetToken ¶ added in v0.2.10
func (l *RFencedLock) LockAndGetToken(ctx context.Context, clientID string, ttl time.Duration) (int64, error)
LockAndGetToken blocks until acquired, returning the fencing token.
func (RFencedLock) Name ¶ added in v0.2.10
func (o RFencedLock) Name() string
Name returns the Redis key name of the object.
func (RFencedLock) RemainTTL ¶ added in v0.2.10
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (RFencedLock) Rename ¶ added in v0.2.10
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RFencedLock) TryLockAndGetToken ¶ added in v0.2.10
func (l *RFencedLock) TryLockAndGetToken(ctx context.Context, clientID string, ttl time.Duration) (int64, error)
TryLockAndGetToken attempts one acquisition, returning the new fencing token (0 when the lock is held by someone else).
type RFunction ¶ added in v0.2.12
type RFunction struct {
// contains filtered or unexported fields
}
RFunction manages Redis functions (FUNCTION LOAD / FCALL), mirroring Redisson's RFunction. Redis-native - wire-safe across languages.
func (*RFunction) Call ¶ added in v0.2.12
func (f *RFunction) Call(ctx context.Context, function string, keys []string, args ...any) (any, error)
Call invokes a registered function (FCALL). keys are the function's key arguments, args the remaining arguments.
func (*RFunction) CallReadOnly ¶ added in v0.2.12
func (f *RFunction) CallReadOnly(ctx context.Context, function string, keys []string, args ...any) (any, error)
CallReadOnly invokes via FCALL_RO (read-only replica routing).
type RGcra ¶ added in v0.2.13
type RGcra struct {
// contains filtered or unexported fields
}
RGcra is Redis GCRA rate limiting (RedissonGcra). Uses the GCRA command when available (Redis 8+); tests skip when the server lacks it.
func (*RGcra) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (*RGcra) Name ¶ added in v0.2.13
func (o *RGcra) Name() string
Name returns the Redis key name of the object.
func (*RGcra) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RGcra) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
type RGeo ¶ added in v0.2.2
type RGeo struct {
// contains filtered or unexported fields
}
RGeo is a distributed geospatial index (Redis GEO / sorted-set backed). Members are codec-encoded (Redisson JsonJacksonCodec interop); searches use GEOSEARCH (GEORADIUS is removed in Redis 8).
func (*RGeo) AddIfExists ¶ added in v0.2.13
func (g *RGeo) AddIfExists(ctx context.Context, longitude, latitude float64, member any) (bool, error)
AddIfExists updates a member only when it already exists (GEOADD XX).
func (*RGeo) AddMany ¶ added in v0.2.13
AddMany stores all locations and returns the number of newly added members.
func (*RGeo) ClearExpire ¶ added in v0.2.2
ClearExpire removes the TTL (key becomes persistent).
func (*RGeo) Dist ¶ added in v0.2.2
Dist returns the distance between two members (-1 when either missing).
func (*RGeo) HashMany ¶ added in v0.2.13
HashMany returns geohashes aligned with members; missing members yield "".
func (*RGeo) Name ¶ added in v0.2.2
func (o *RGeo) Name() string
Name returns the Redis key name of the object.
func (*RGeo) PosMany ¶ added in v0.2.13
PosMany returns positions aligned with members; missing members yield nil.
func (*RGeo) RemainTTL ¶ added in v0.2.2
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RGeo) Rename ¶ added in v0.2.2
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RGeo) Search ¶ added in v0.2.2
func (g *RGeo) Search(ctx context.Context, longitude, latitude, radius float64, unit string, withDist, asc bool) ([]GeoEntry, error)
Search returns members within radius of lon/lat (GEOSEARCH), optionally with distances sorted ascending. WITHCOORD is always requested (go-redis cannot parse the reply shape without any WITH* flag).
func (*RGeo) SearchByMember ¶ added in v0.2.2
func (g *RGeo) SearchByMember(ctx context.Context, member any, radius float64, unit string, withDist, asc bool) ([]GeoEntry, error)
SearchByMember returns members within radius of an existing member.
func (*RGeo) StoreSearchTo ¶ added in v0.2.13
func (g *RGeo) StoreSearchTo(ctx context.Context, dest string, longitude, latitude, radius float64, unit string, count int) (int64, error)
StoreSearchTo stores members within radius in dest and returns the count.
type RHyperLogLog ¶ added in v0.2.2
type RHyperLogLog struct {
// contains filtered or unexported fields
}
RHyperLogLog estimates cardinality (Redis PFADD/PFCOUNT/PFMERGE). Members are codec-encoded; the sketch itself is Redis-native so cross-language interop is automatic.
func (*RHyperLogLog) Add ¶ added in v0.2.2
Add adds an element. Returns true when the register was updated.
func (*RHyperLogLog) AddAll ¶ added in v0.2.2
AddAll adds multiple elements. Returns true when any register changed.
func (*RHyperLogLog) ClearExpire ¶ added in v0.2.2
ClearExpire removes the TTL (key becomes persistent).
func (*RHyperLogLog) Count ¶ added in v0.2.2
func (h *RHyperLogLog) Count(ctx context.Context) (int64, error)
Count returns the estimated cardinality.
func (*RHyperLogLog) CountWith ¶ added in v0.2.2
CountWith returns the union cardinality with other HLLs.
func (*RHyperLogLog) MergeInto ¶ added in v0.2.2
MergeInto merges this HLL (and others) into a destination.
func (*RHyperLogLog) MergeWith ¶ added in v0.2.2
func (h *RHyperLogLog) MergeWith(ctx context.Context, others ...string) error
MergeWith merges the other HLLs into this one.
func (*RHyperLogLog) Name ¶ added in v0.2.2
func (o *RHyperLogLog) Name() string
Name returns the Redis key name of the object.
func (*RHyperLogLog) RemainTTL ¶ added in v0.2.2
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RHyperLogLog) Rename ¶ added in v0.2.2
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
type RIdGenerator ¶
type RIdGenerator struct {
// contains filtered or unexported fields
}
RIdGenerator is a distributed id generator: each process caches a range of ids (allocation size persisted at {name}:allocation, Redisson-compatible) to keep Redis round-trips low.
func (*RIdGenerator) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RIdGenerator) Delete ¶
func (g *RIdGenerator) Delete(ctx context.Context) error
Delete removes both the counter and its allocation-size companion.
func (*RIdGenerator) Name ¶
func (o *RIdGenerator) Name() string
Name returns the Redis key name of the object.
func (*RIdGenerator) NextID ¶
func (g *RIdGenerator) NextID(ctx context.Context) (int64, error)
NextID returns the next unique id (unique, not strictly monotonic).
func (*RIdGenerator) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RIdGenerator) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
type RJsonBucket ¶ added in v0.2.13
type RJsonBucket struct {
// contains filtered or unexported fields
}
RJsonBucket stores a JSON document via RedisJSON (JSON.SET/GET/…). Requires the RedisJSON module; tests skip when commands are unavailable.
func (*RJsonBucket) ArrayAppend ¶ added in v0.2.13
ArrayAppend appends values to the array at path.
func (*RJsonBucket) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (*RJsonBucket) DeletePath ¶ added in v0.2.13
DeletePath deletes path (or the whole key when path is empty/$ with JSON.DEL).
func (*RJsonBucket) Get ¶ added in v0.2.13
func (b *RJsonBucket) Get(ctx context.Context) (any, error)
Get returns the document root.
func (*RJsonBucket) Name ¶ added in v0.2.13
func (o *RJsonBucket) Name() string
Name returns the Redis key name of the object.
func (*RJsonBucket) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RJsonBucket) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RJsonBucket) Set ¶ added in v0.2.13
func (b *RJsonBucket) Set(ctx context.Context, value any) error
Set stores value at the document root ($).
type RJsonBuckets ¶ added in v0.2.13
type RJsonBuckets struct {
// contains filtered or unexported fields
}
RJsonBuckets provides mass get/set for JSON buckets.
type RKeys ¶
type RKeys struct {
// contains filtered or unexported fields
}
RKeys provides keyspace management (SCAN iteration, pattern deletion, counts), mirroring Redisson's RKeys.
func (*RKeys) ClearExpire ¶ added in v0.2.13
ClearExpire removes a key's TTL.
func (*RKeys) CountExists ¶
CountExists returns how many of the given keys exist.
func (*RKeys) DeleteByPattern ¶
DeleteByPattern removes every key matching a glob pattern (SCAN + DEL batches), returning the count removed.
func (*RKeys) FlushAll ¶ added in v0.2.13
FlushAll empties every database. In cluster mode it runs on every master.
func (*RKeys) ForEachKey ¶
ForEachKey iterates every key (optionally matching a glob pattern) via SCAN, invoking fn for each. SCAN is incremental and safe for live use; fn returning an error stops the iteration and propagates it.
func (*RKeys) Migrate ¶ added in v0.2.13
func (k *RKeys) Migrate( ctx context.Context, key, host string, port, db int, timeout time.Duration, ) error
Migrate atomically moves key to another Redis instance.
func (*RKeys) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining TTL with millisecond precision (-1 no expiry, -2 missing).
type RLexSortedSet ¶
type RLexSortedSet struct {
// contains filtered or unexported fields
}
RLexSortedSet is a lexicographically sorted set. Members are stored RAW (not codec-encoded), matching Redisson's RLexSortedSet which bypasses the codec so lexicographic ordering uses the natural byte form (redi.py verified this Redisson special case).
func (*RLexSortedSet) Clear ¶
func (s *RLexSortedSet) Clear(ctx context.Context) error
Clear removes the set.
func (*RLexSortedSet) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RLexSortedSet) CountRange ¶
CountRange counts members in the inclusive [min, max] range.
func (*RLexSortedSet) First ¶
func (s *RLexSortedSet) First(ctx context.Context) (string, error)
First returns the smallest member ("" when empty).
func (*RLexSortedSet) Last ¶
func (s *RLexSortedSet) Last(ctx context.Context) (string, error)
Last returns the largest member ("" when empty).
func (*RLexSortedSet) Name ¶
func (o *RLexSortedSet) Name() string
Name returns the Redis key name of the object.
func (*RLexSortedSet) PollFirst ¶
func (s *RLexSortedSet) PollFirst(ctx context.Context) (string, error)
PollFirst removes and returns the smallest member ("" when empty).
func (*RLexSortedSet) PollLast ¶
func (s *RLexSortedSet) PollLast(ctx context.Context) (string, error)
PollLast removes and returns the largest member ("" when empty).
func (*RLexSortedSet) Random ¶ added in v0.2.13
func (s *RLexSortedSet) Random(ctx context.Context) (string, error)
Random returns one random member, or "" when empty.
func (*RLexSortedSet) RandomN ¶ added in v0.2.13
RandomN returns random members using Redis ZRANDMEMBER count semantics.
func (*RLexSortedSet) RangeByLex ¶
func (s *RLexSortedSet) RangeByLex(ctx context.Context, min, max string, offset, count int64) ([]string, error)
RangeByLex returns members in the inclusive [min, max] lex range.
func (*RLexSortedSet) RangeByLexReversed ¶ added in v0.2.13
func (s *RLexSortedSet) RangeByLexReversed( ctx context.Context, min, max string, offset, count int64, ) ([]string, error)
RangeByLexReversed returns the inclusive [min, max] range in reverse order.
func (*RLexSortedSet) RangeHead ¶
func (s *RLexSortedSet) RangeHead(ctx context.Context, toValue string, offset, count int64) ([]string, error)
RangeHead returns members lexicographically before toValue (open range).
func (*RLexSortedSet) RangeHeadReversed ¶ added in v0.2.13
func (s *RLexSortedSet) RangeHeadReversed( ctx context.Context, toValue string, offset, count int64, ) ([]string, error)
RangeHeadReversed returns members before toValue in reverse order.
func (*RLexSortedSet) RangeReversed ¶ added in v0.2.13
RangeReversed returns members by descending rank [start, stop].
func (*RLexSortedSet) RangeTail ¶
func (s *RLexSortedSet) RangeTail(ctx context.Context, fromValue string, offset, count int64) ([]string, error)
RangeTail returns members lexicographically after fromValue (open range).
func (*RLexSortedSet) RangeTailReversed ¶ added in v0.2.13
func (s *RLexSortedSet) RangeTailReversed( ctx context.Context, fromValue string, offset, count int64, ) ([]string, error)
RangeTailReversed returns members after fromValue in reverse order.
func (*RLexSortedSet) Rank ¶ added in v0.2.13
Rank returns the 0-based ascending rank, or -1 when absent.
func (*RLexSortedSet) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RLexSortedSet) RemoveRangeByLex ¶
RemoveRangeByLex removes members in the inclusive [min, max] range.
func (*RLexSortedSet) RemoveRangeHead ¶
RemoveRangeHead removes members before toValue (open range).
func (*RLexSortedSet) RemoveRangeTail ¶
RemoveRangeTail removes members after fromValue (open range).
func (*RLexSortedSet) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RLexSortedSet) RevRank ¶ added in v0.2.13
RevRank returns the 0-based descending rank, or -1 when absent.
func (*RLexSortedSet) Size ¶
func (s *RLexSortedSet) Size(ctx context.Context) (int64, error)
Size returns the member count.
type RList ¶
type RList struct {
// contains filtered or unexported fields
}
RList is a distributed list backed by a Redis List (RPUSH / LPOP). Elements are codec (JSON) encoded, Redisson-compatible.
func (*RList) AddAfter ¶ added in v0.2.13
AddAfter inserts element after pivot (LINSERT AFTER). Returns the list length after insert, or -1 when pivot is missing.
func (*RList) AddBefore ¶ added in v0.2.13
AddBefore inserts element before pivot (LINSERT BEFORE). Returns the list length after insert, or -1 when pivot is missing.
func (*RList) AddCounted ¶ added in v0.2.13
AddCounted appends values and returns the list length after the push (Redis RPUSH).
func (*RList) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RList) FastRemoveByIndex ¶ added in v0.2.13
FastRemoveByIndex removes the element at index without returning it (Redisson fastRemove).
func (*RList) Get ¶
Get returns the element at the given index (0-based). Returns (nil, nil) when the index is out of range.
func (*RList) GetInto ¶ added in v0.2.13
GetInto decodes the element at index into target. Returns false when the index is out of range.
func (*RList) IndexOf ¶ added in v0.2.13
IndexOf returns the first index of value, or -1 when absent.
func (*RList) LastIndexOf ¶ added in v0.2.13
LastIndexOf returns the last index of value, or -1 when absent.
func (*RList) Remove ¶
Remove removes up to count occurrences of value (count semantics match Redis LREM). Prefer RemoveCounted when you need the removed tally.
func (*RList) RemoveByIndex ¶ added in v0.2.13
RemoveByIndex removes and returns the element at index (Redisson remove(int) / fastRemove tombstone path). Returns (nil, nil) when out of range.
func (*RList) RemoveCounted ¶ added in v0.2.13
RemoveCounted is LREM and returns how many elements were removed.
func (*RList) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
type RListMultimap ¶
type RListMultimap struct{ RMultimap }
RListMultimap stores an ordered value list per key.
func (*RListMultimap) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RListMultimap) Name ¶
func (o *RListMultimap) Name() string
Name returns the Redis key name of the object.
func (*RListMultimap) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RListMultimap) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
type RListMultimapCache ¶ added in v0.2.13
type RListMultimapCache struct {
// contains filtered or unexported fields
}
RListMultimapCache stores an ordered value list per key with Redisson's per-key expiration metadata.
func (RListMultimapCache) Clear ¶ added in v0.2.13
Clear removes the index, timeout metadata and every per-key collection.
func (RListMultimapCache) ContainsEntry ¶ added in v0.2.13
ContainsEntry reports whether the current key contains value.
func (RListMultimapCache) ContainsKey ¶ added in v0.2.13
ContainsKey reports whether key currently has values.
func (RListMultimapCache) ContainsValue ¶ added in v0.2.13
ContainsValue reports whether any live key is associated with value.
func (RListMultimapCache) Entries ¶ added in v0.2.13
func (m RListMultimapCache) Entries(ctx context.Context) ([]MultimapEntry, error)
Entries returns every live key/value association.
func (RListMultimapCache) Expire ¶ added in v0.2.13
Expire applies ttl to the index, timeout metadata and every per-key collection, matching RedissonMultimapCache's whole-object expiration.
func (RListMultimapCache) ExpireKey ¶ added in v0.2.13
func (m RListMultimapCache) ExpireKey( ctx context.Context, key any, ttl time.Duration, ) (bool, error)
ExpireKey sets the lifetime of every value associated with key.
func (RListMultimapCache) Get ¶ added in v0.2.13
Get returns the current values. Expired keys are hidden and lazily removed from the HASH, timeout ZSET and per-key collection.
func (RListMultimapCache) GetFairLock ¶ added in v0.2.13
GetFairLock returns the Redisson fair lock for a multimap-cache key.
func (RListMultimapCache) GetLock ¶ added in v0.2.13
GetLock returns the Redisson lock associated with a multimap-cache key.
func (RListMultimapCache) GetReadWriteLock ¶ added in v0.2.13
func (m RListMultimapCache) GetReadWriteLock(key any) *RReadWriteLock
GetReadWriteLock returns the Redisson read-write lock for a cache key.
func (RListMultimapCache) GetSemaphore ¶ added in v0.2.13
func (m RListMultimapCache) GetSemaphore(key any) *RSemaphore
GetSemaphore returns the Redisson semaphore for a multimap-cache key.
func (RListMultimapCache) IsEmpty ¶ added in v0.2.13
IsEmpty reports whether the cache has no live associations.
func (RListMultimapCache) Put ¶ added in v0.2.13
Put associates value with key. For an expired key it first removes the old collection, so a new association starts a fresh non-expiring key.
func (RListMultimapCache) ReadAllKeySet ¶ added in v0.2.13
ReadAllKeySet is the eager Redisson-style alias of KeySet.
func (RListMultimapCache) RemoveAll ¶ added in v0.2.13
RemoveAll removes key, its values and expiration metadata.
func (RListMultimapCache) ReplaceValues ¶ added in v0.2.13
func (m RListMultimapCache) ReplaceValues( ctx context.Context, key any, values ...any, ) ([]any, error)
ReplaceValues replaces all live values associated with key and returns the previous values. The key keeps its existing per-key expiration.
func (RListMultimapCache) Size ¶ added in v0.2.13
Size returns the number of live key/value associations.
func (RListMultimapCache) StartAutoEviction ¶ added in v0.2.13
StartAutoEviction periodically runs lazy expiry cleanup until the client closes (optional; default access paths already clean lazily).
type RListMultimapCacheNative ¶ added in v0.2.13
type RListMultimapCacheNative struct{ *RListMultimap }
func (RListMultimapCacheNative) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (RListMultimapCacheNative) Name ¶ added in v0.2.13
func (o RListMultimapCacheNative) Name() string
Name returns the Redis key name of the object.
func (RListMultimapCacheNative) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (RListMultimapCacheNative) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
type RLocalCachedMap ¶ added in v0.2.5
type RLocalCachedMap struct {
*RMap
// contains filtered or unexported fields
}
RLocalCachedMap is an RMap with an in-process near cache.
Data interoperability: the Redis-backed map uses the exact RMap wire format, so Java Redisson / redi.py can read and write the same entries.
Invalidation interoperability: Java's LocalCachedMapInvalidation protocol (key-hash byte arrays + updates log + Java object encoding) is NOT replicated; invalidation broadcast uses a Go-internal channel `{name}:inval` (JSON messages). Go instances invalidate each other; Java writers are not broadcast to Go caches (documented in COMPATIBILITY.md). Reads always have the Redis fallback, so Java writes are picked up by Go after the local entry is evicted or the cache is cleared.
func (*RLocalCachedMap) CachedKeys ¶ added in v0.2.5
func (m *RLocalCachedMap) CachedKeys() []string
CachedKeys returns the keys currently held in the local cache.
func (*RLocalCachedMap) CachedValues ¶ added in v0.2.13
func (m *RLocalCachedMap) CachedValues() []any
CachedValues returns a snapshot of values currently held locally.
func (*RLocalCachedMap) Clear ¶ added in v0.2.5
func (m *RLocalCachedMap) Clear(ctx context.Context) error
Clear deletes the Redis map, empties the local cache and broadcasts a full invalidation.
func (RLocalCachedMap) ClearExpire ¶ added in v0.2.5
ClearExpire removes the TTL (key becomes persistent).
func (*RLocalCachedMap) ClearLocalCache ¶ added in v0.2.5
func (m *RLocalCachedMap) ClearLocalCache()
ClearLocalCache empties only the local cache (no Redis writes).
func (*RLocalCachedMap) Destroy ¶ added in v0.2.5
func (m *RLocalCachedMap) Destroy()
Destroy stops the listener goroutine (also triggered by Client.Close).
func (*RLocalCachedMap) FastPut ¶ added in v0.2.13
FastPut write-throughs like Put and returns whether the field was new.
func (*RLocalCachedMap) FastPutIfExists ¶ added in v0.2.13
func (m *RLocalCachedMap) FastPutIfExists(ctx context.Context, field string, value any) (bool, error)
FastPutIfExists write-throughs when the field already exists.
func (*RLocalCachedMap) FastRemove ¶ added in v0.2.13
FastRemove deletes fields, drops them from the local cache, and broadcasts.
func (*RLocalCachedMap) FastReplace ¶ added in v0.2.13
FastReplace is an alias of FastPutIfExists with local-cache update.
func (*RLocalCachedMap) Get ¶ added in v0.2.5
Get returns the value for field, serving from the local cache when present (a hit makes NO Redis round-trip).
func (*RLocalCachedMap) GetCachedMap ¶ added in v0.2.13
func (m *RLocalCachedMap) GetCachedMap() map[string]any
GetCachedMap returns a decoded snapshot of the local cache.
func (*RLocalCachedMap) GetInto ¶ added in v0.2.13
GetInto decodes the value into target, serving from the local cache on hit.
func (RLocalCachedMap) Name ¶ added in v0.2.5
func (o RLocalCachedMap) Name() string
Name returns the Redis key name of the object.
func (*RLocalCachedMap) PreloadCache ¶ added in v0.2.13
func (m *RLocalCachedMap) PreloadCache(ctx context.Context, count ...int) error
PreloadCache warms the local cache with all current Redis entries. The optional count is accepted as the Redisson scan-batch hint.
func (*RLocalCachedMap) Put ¶ added in v0.2.5
Put writes through to Redis, updates the local cache and broadcasts invalidation to the other Go instances.
func (*RLocalCachedMap) PutAll ¶ added in v0.2.13
PutAll write-throughs every entry, updates the local cache, and broadcasts one invalidation per field (same granularity as Put).
func (*RLocalCachedMap) PutIfAbsent ¶ added in v0.2.5
PutIfAbsent writes only when absent; on success the local cache is updated and the invalidation broadcast fires.
func (RLocalCachedMap) RemainTTL ¶ added in v0.2.5
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RLocalCachedMap) Remove ¶ added in v0.2.5
func (m *RLocalCachedMap) Remove(ctx context.Context, field string) error
Remove deletes the field everywhere and broadcasts.
func (RLocalCachedMap) Rename ¶ added in v0.2.5
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RLocalCachedMap) Replace ¶ added in v0.2.13
Replace write-throughs when the field exists; updates local cache and broadcasts on success.
func (*RLocalCachedMap) ReplaceIf ¶ added in v0.2.13
func (m *RLocalCachedMap) ReplaceIf(ctx context.Context, field string, oldValue, newValue any) (bool, error)
ReplaceIf write-throughs on compare-and-set success.
func (*RLocalCachedMap) SetLocalCacheLimit ¶ added in v0.2.5
func (m *RLocalCachedMap) SetLocalCacheLimit(ttl time.Duration, maxEntries int)
SetLocalCacheLimit configures local eviction: entries older than ttl are dropped on access, and the cache stops caching beyond maxEntries (0 = unlimited). Call before first use.
type RLock ¶
type RLock struct {
// contains filtered or unexported fields
}
RLock is a distributed re-entrant lock, wire-compatible with Redisson's RLock: a Redis HASH at the raw name whose fields are holder ids with re-entrancy counts, and a pub/sub channel redisson_lock__channel:{name} used to wake up waiting acquirers on release (~0ms wakeup vs 50-100ms polling).
The caller-supplied clientID is used as the HASH field directly. Prefer Client.HolderID(threadID) for a Redisson-shaped "uuid:threadId" field that stays stable across re-entry and Unlock.
Lock semantics (matching Redisson):
- ttl <= 0: watchdog mode – lease = Config.LockWatchdogTimeout (30s default), renewed every lease/3 until Unlock.
- ttl > 0: fixed lease, no renewal, lock expires on its own.
Example ¶
package main
import (
"context"
"fmt"
"log"
"time"
redi "github.com/linkerlin/redi.go"
)
func main() {
client, err := redi.NewClient(redi.DefaultConfig())
if err != nil {
fmt.Println("skip:", err)
return
}
defer client.Close() //nolint:errcheck // example
ctx := context.Background()
_, _ = client.GetKeys().Delete(ctx, "demo:try-lock")
lock := client.GetRLock("demo:try-lock")
// One-shot acquisition without blocking.
ok, err := lock.TryLock(ctx, "app:42", time.Minute)
if err != nil {
log.Fatal(err)
}
fmt.Println("first acquire:", ok)
// Re-entry by the same holder increments the counter.
if err := lock.Lock(ctx, "app:42", time.Minute); err != nil {
log.Fatal(err)
}
n, _ := lock.HoldCount(ctx, "app:42")
fmt.Println("hold count:", n)
_ = lock.Unlock(ctx, "app:42")
_ = lock.Unlock(ctx, "app:42")
}
Output: first acquire: true hold count: 2
func (*RLock) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RLock) ForceUnlock ¶
ForceUnlock deletes the lock regardless of owner and wakes all waiters.
func (*RLock) Lock ¶
Lock acquires the lock, blocking until success or ctx cancellation. See the RLock doc for ttl semantics.
func (*RLock) RemainTimeToLive ¶ added in v0.2.13
RemainTimeToLive returns the remaining lease. Negative durations follow go-redis PTTL conventions (approximately -2ns when the key is absent, -1ns when present without expiry).
func (*RLock) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RLock) TryLock ¶
TryLock attempts to acquire the lock once, returning false immediately when held by someone else.
func (*RLock) TryLockWait ¶ added in v0.2.13
func (l *RLock) TryLockWait(ctx context.Context, clientID string, wait, ttl time.Duration) (bool, error)
TryLockWait tries to acquire until wait elapses or ctx is cancelled. lease/ttl semantics match Lock (ttl<=0 enables watchdog).
type RLongAdder ¶ added in v0.2.8
type RLongAdder struct {
// contains filtered or unexported fields
}
RLongAdder is a high-contention distributed counter: writes accumulate in a local atomic (zero network), Sum() coordinates a flush across all live instances (Go and Java alike) and returns the grand total. Wire-compatible with Redisson's RedissonLongAdder.
func (*RLongAdder) Add ¶ added in v0.2.8
func (a *RLongAdder) Add(x int64)
Add adds x to the local buffer (no network round-trip).
func (*RLongAdder) Decrement ¶ added in v0.2.8
func (a *RLongAdder) Decrement()
Decrement subtracts 1.
func (*RLongAdder) Destroy ¶ added in v0.2.8
func (a *RLongAdder) Destroy()
Destroy unsubscribes this instance (also triggered by Client.Close).
type RMap ¶
type RMap struct {
// contains filtered or unexported fields
}
RMap is a distributed map backed by a Redis Hash, wire-compatible with Redisson's RMap using JsonJacksonCodec: both fields and values are JSON encoded by the client Codec.
func (*RMap) AddAndGet ¶
AddAndGet atomically adds delta to the numeric value of field and returns the new value. The stored value must be a bare JSON number.
func (*RMap) Clear ¶
Clear removes the entire map key (DEL), not individual fields. Must not call Delete with no fields — that path is a no-op by design.
func (*RMap) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RMap) ContainsKey ¶
ContainsKey reports whether the map contains the given field.
func (*RMap) ContainsValue ¶ added in v0.2.13
ContainsValue reports whether any field stores value (codec equality).
func (*RMap) FastPut ¶ added in v0.2.13
FastPut sets field and reports whether it was a new field (true) or an update of an existing one (false) — Redisson fastPut semantics (HSET).
func (*RMap) FastPutIfAbsent ¶ added in v0.2.13
FastPutIfAbsent is the Redisson-style alias of PutIfAbsent.
func (*RMap) FastPutIfExists ¶ added in v0.2.13
FastPutIfExists sets field only when it already exists. Returns true when written — Redisson fastPutIfExists.
func (*RMap) FastRemove ¶ added in v0.2.13
FastRemove deletes fields and returns how many were actually removed (Redisson fastRemove / HDEL).
func (*RMap) FastReplace ¶ added in v0.2.13
FastReplace is an alias of FastPutIfExists (Redisson fastReplace).
func (*RMap) GetAllKeys ¶ added in v0.2.13
GetAllKeys returns values for the given fields (missing fields omitted).
func (*RMap) GetCountDownLatch ¶ added in v0.2.13
func (m *RMap) GetCountDownLatch(key any) *RCountDownLatch
GetCountDownLatch returns the Redisson latch associated with a map key.
func (*RMap) GetFairLock ¶ added in v0.2.13
GetFairLock returns the Redisson fair lock associated with a map key.
func (*RMap) GetInto ¶ added in v0.2.13
GetInto decodes the value for field into target. Returns false when absent.
Example ¶
package main
import (
"context"
"fmt"
redi "github.com/linkerlin/redi.go"
)
func main() {
client, err := redi.NewClient(redi.DefaultConfig())
if err != nil {
fmt.Println("skip:", err)
return
}
defer client.Close() //nolint:errcheck // example
ctx := context.Background()
_, _ = client.GetKeys().Delete(ctx, "demo:into-map")
type user struct {
Name string `json:"name"`
}
m := client.GetMap("demo:into-map")
_ = m.Put(ctx, "u1", user{Name: "ada"})
var u user
ok, _ := m.GetInto(ctx, "u1", &u)
fmt.Println(ok, u.Name)
_ = m.Clear(ctx)
}
Output: true ada
func (*RMap) GetLock ¶ added in v0.2.13
GetLock returns the Redisson lock associated with a map key.
func (*RMap) GetPermitExpirableSemaphore ¶ added in v0.2.13
func (m *RMap) GetPermitExpirableSemaphore(key any) *RPermitExpirableSemaphore
GetPermitExpirableSemaphore returns the Redisson expirable semaphore for a map key.
func (*RMap) GetReadWriteLock ¶ added in v0.2.13
func (m *RMap) GetReadWriteLock(key any) *RReadWriteLock
GetReadWriteLock returns the Redisson read-write lock for a map key.
func (*RMap) GetSemaphore ¶ added in v0.2.13
func (m *RMap) GetSemaphore(key any) *RSemaphore
GetSemaphore returns the Redisson semaphore associated with a map key.
func (*RMap) PutAll ¶ added in v0.2.13
PutAll writes every entry in a single HSET (empty map is a no-op).
func (*RMap) PutIfAbsent ¶
PutIfAbsent sets field only when absent. Returns true when set.
func (*RMap) PutIfExists ¶ added in v0.2.13
PutIfExists sets field only when it already exists. Returns true when written.
func (*RMap) RandomEntries ¶ added in v0.2.13
RandomEntries returns up to count random distinct field-value pairs.
func (*RMap) RandomKeys ¶ added in v0.2.13
RandomKeys returns up to count random distinct fields.
func (*RMap) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RMap) Replace ¶ added in v0.2.13
Replace sets field only when it already exists. Returns the previous value, or (nil, nil) when the field was absent (unchanged).
func (*RMap) ReplaceIf ¶ added in v0.2.13
ReplaceIf sets field to newValue only when the current value equals oldValue (codec-encoded equality). Returns true when replaced.
type RMapCache ¶
type RMapCache struct {
*RMap
// contains filtered or unexported fields
}
RMapCache is an RMap with per-entry TTL and maxIdle, wire-compatible with Redisson's RedissonMapCache:
HASH {name} field -> packed value
ZSET redisson__timeout__set:{name} expiry deadlines (score = ts ms)
ZSET redisson__idle__set:{name} idle deadlines (score = ts ms)
The packed value format is Redisson's struct layout: little-endian float64 (maxIdle ms) + little-endian uint64 (codec length) + codec bytes.
Expired entries are purged lazily on access and by an optional background sweeper (StartAutoEviction). Entry events (created/updated/removed/expired) are published on Redisson-compatible channels and can be consumed with AddListener.
func (*RMapCache) AddListener ¶
AddListener registers an entry event listener for the given kind (EventCreated/EventUpdated/EventRemoved/EventExpired). The callback receives (kind, key, value, oldValue); oldValue is non-nil only for EventUpdated. Returns the listener id for RemoveListener.
func (RMapCache) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RMapCache) ContainsKey ¶ added in v0.2.13
ContainsKey reports whether the cache contains a live field.
func (*RMapCache) ContainsValue ¶ added in v0.2.13
ContainsValue reports whether a live field stores value (codec equality).
func (*RMapCache) Delete ¶ added in v0.2.13
Delete removes fields, or the cache and companions when no fields are given.
func (*RMapCache) EvictExpired ¶
EvictExpired purges expired entries now, returning how many were removed.
func (*RMapCache) ExpireEntries ¶ added in v0.2.13
func (m *RMapCache) ExpireEntries( ctx context.Context, fields []string, ttl, maxIdle time.Duration, ) (int, error)
ExpireEntries replaces the TTL/maxIdle policy for live fields.
func (*RMapCache) ExpireEntriesIfNotSet ¶ added in v0.2.13
func (m *RMapCache) ExpireEntriesIfNotSet( ctx context.Context, fields []string, ttl, maxIdle time.Duration, ) (int, error)
ExpireEntriesIfNotSet sets expiration only on fields without a policy.
func (*RMapCache) ExpireEntry ¶ added in v0.2.13
func (m *RMapCache) ExpireEntry( ctx context.Context, field string, ttl, maxIdle time.Duration, ) (bool, error)
ExpireEntry replaces the TTL/maxIdle policy of an existing live entry. A non-positive duration disables that expiration dimension.
func (*RMapCache) ExpireEntryIfNotSet ¶ added in v0.2.13
func (m *RMapCache) ExpireEntryIfNotSet( ctx context.Context, field string, ttl, maxIdle time.Duration, ) (bool, error)
ExpireEntryIfNotSet sets expiration only when the entry has no TTL/maxIdle.
func (*RMapCache) FastPut ¶ added in v0.2.13
func (m *RMapCache) FastPut( ctx context.Context, field string, value any, durations ...time.Duration, ) (bool, error)
FastPut stores an entry with optional ttl/maxIdle and reports whether new.
func (*RMapCache) FastPutIfAbsent ¶ added in v0.2.13
func (m *RMapCache) FastPutIfAbsent( ctx context.Context, field string, value any, durations ...time.Duration, ) (bool, error)
FastPutIfAbsent stores only when absent, with optional ttl/maxIdle.
func (*RMapCache) FastPutIfExists ¶ added in v0.2.13
FastPutIfExists is the Redisson-style alias of PutIfExists.
func (*RMapCache) FastRemove ¶ added in v0.2.13
FastRemove deletes fields and their deadline entries.
func (*RMapCache) FastReplace ¶ added in v0.2.13
FastReplace is the Redisson-style alias of PutIfExists.
func (*RMapCache) Get ¶
Get returns the value for field (nil when absent or expired). Access refreshes the maxIdle deadline.
func (*RMapCache) GetAll ¶ added in v0.2.13
GetAll returns all live field-value pairs with packed values decoded.
func (*RMapCache) GetAllKeys ¶ added in v0.2.13
GetAllKeys returns live values for the requested fields.
func (*RMapCache) GetAllWithTTLOnly ¶ added in v0.2.13
func (m *RMapCache) GetAllWithTTLOnly( ctx context.Context, fields ...string, ) (map[string]any, error)
GetAllWithTTLOnly returns requested entries after checking only their explicit TTL. Max-idle expiration is intentionally ignored and not renewed.
func (*RMapCache) GetInto ¶ added in v0.2.13
GetInto decodes the value for field into target. Returns false when absent.
func (RMapCache) Name ¶
func (o RMapCache) Name() string
Name returns the Redis key name of the object.
func (*RMapCache) Put ¶
func (m *RMapCache) Put(ctx context.Context, field string, value any, durations ...time.Duration) error
Put sets field with optional per-entry ttl and maxIdle (0 = disabled). Omitting both durations stores an entry without expiry. Publishes a created or updated entry event.
func (*RMapCache) PutAll ¶ added in v0.2.13
PutAll writes entries without expiry using the map-cache packed format.
func (*RMapCache) PutIfAbsent ¶
func (m *RMapCache) PutIfAbsent(ctx context.Context, field string, value any, durations ...time.Duration) (bool, error)
PutIfAbsent sets field only when absent, with optional ttl/maxIdle. Returns true when set.
func (*RMapCache) PutIfExists ¶ added in v0.2.13
PutIfExists stores value without expiry only when field exists.
func (RMapCache) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RMapCache) RemainTTLForKey ¶
RemainTTLForKey returns the remaining per-entry TTL (-2 when absent).
func (*RMapCache) Remove ¶
Remove deletes field and its deadline entries, publishing a removed event.
func (*RMapCache) RemoveListener ¶
RemoveListener unregisters a listener.
func (RMapCache) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RMapCache) Replace ¶ added in v0.2.13
Replace updates an existing live field without expiry and returns its old value.
func (*RMapCache) ReplaceIf ¶ added in v0.2.13
func (m *RMapCache) ReplaceIf(ctx context.Context, field string, oldValue, newValue any) (bool, error)
ReplaceIf updates an existing live field when its decoded value matches.
func (*RMapCache) SetMaxSize ¶ added in v0.2.13
SetMaxSize configures LRU eviction when the cache grows beyond size. A size of zero disables capacity eviction.
func (*RMapCache) SetMaxSizeMode ¶ added in v0.2.13
SetMaxSizeMode configures the maximum size and LRU or LFU eviction.
func (*RMapCache) StartAutoEviction ¶
StartAutoEviction runs a background sweeper every interval until the client closes. Repeated calls are no-ops.
func (*RMapCache) TrySetMaxSize ¶ added in v0.2.13
TrySetMaxSize sets the maximum size with LRU eviction only when no size policy has been configured yet.
func (*RMapCache) TrySetMaxSizeMode ¶ added in v0.2.13
func (m *RMapCache) TrySetMaxSizeMode( ctx context.Context, size int, mode EvictionMode, ) (bool, error)
TrySetMaxSizeMode sets the maximum size and eviction mode once.
type RMapCacheNative ¶ added in v0.2.13
type RMapCacheNative struct {
*RMap
}
RMapCacheNative is a map with per-entry TTL using Redis hash-field expiration (HPEXPIRE / HPEXPIREAT / HPTTL), wire-compatible with RedissonMapCacheNative 4.6.1. Values are plain codec bytes (no MapCache packed header). Requires Redis ≥ 7.4 / 8.x field TTL support.
func (RMapCacheNative) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (*RMapCacheNative) ExpireEntry ¶ added in v0.2.13
func (m *RMapCacheNative) ExpireEntry(ctx context.Context, field string, ttl time.Duration) (bool, error)
ExpireEntry sets a relative TTL on an existing field.
func (*RMapCacheNative) ExpireEntryIfNotSet ¶ added in v0.2.13
func (m *RMapCacheNative) ExpireEntryIfNotSet(ctx context.Context, field string, ttl time.Duration) (bool, error)
ExpireEntryIfNotSet sets TTL only when the field has no expiration (NX).
func (*RMapCacheNative) FastPutIfAbsentWithTTL ¶ added in v0.2.13
func (m *RMapCacheNative) FastPutIfAbsentWithTTL(ctx context.Context, field string, value any, ttl time.Duration) (bool, error)
FastPutIfAbsentWithTTL returns true when the field was inserted with TTL.
func (*RMapCacheNative) FastPutWithTTL ¶ added in v0.2.13
func (m *RMapCacheNative) FastPutWithTTL(ctx context.Context, field string, value any, ttl time.Duration) (bool, error)
FastPutWithTTL sets field with TTL and reports whether the field was new.
func (RMapCacheNative) Name ¶ added in v0.2.13
func (o RMapCacheNative) Name() string
Name returns the Redis key name of the object.
func (*RMapCacheNative) PutIfAbsentWithTTL ¶ added in v0.2.13
func (m *RMapCacheNative) PutIfAbsentWithTTL(ctx context.Context, field string, value any, ttl time.Duration) (any, error)
PutIfAbsentWithTTL sets field only when absent, applying TTL on insert.
func (*RMapCacheNative) PutUntil ¶ added in v0.2.13
func (m *RMapCacheNative) PutUntil(ctx context.Context, field string, value any, at time.Time) (any, error)
PutUntil stores field with an absolute expiry (HPEXPIREAT, unix ms).
func (*RMapCacheNative) PutWithTTL ¶ added in v0.2.13
func (m *RMapCacheNative) PutWithTTL(ctx context.Context, field string, value any, ttl time.Duration) (any, error)
PutWithTTL stores field with a relative TTL (HPEXPIRE).
func (RMapCacheNative) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RMapCacheNative) RemainTTLForKey ¶ added in v0.2.13
RemainTTLForKey returns remaining field TTL. -2 absent, -1 no expiry.
func (RMapCacheNative) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
type RMaps ¶ added in v0.2.13
type RMaps struct {
// contains filtered or unexported fields
}
RMaps performs mass HASH replacements (RedissonMaps set semantics via DEL+HSET).
type RMultiLock ¶ added in v0.2.10
type RMultiLock struct {
// contains filtered or unexported fields
}
RMultiLock groups RLocks into one all-or-nothing lock, mirroring Redisson's RedissonMultiLock orchestration: acquire members in order within the wait budget; on any failure roll back every lock this call acquired. Wire-compatible by construction (plain RLock members).
func (*RMultiLock) Lock ¶ added in v0.2.10
Lock blocks until every member is acquired, the wait budget expires (ErrMultiLockFailed) or ctx ends. Reuses the Redisson lease-time convention: the effective per-member wait is bounded by waitTime.
type RMultimap ¶
type RMultimap struct {
// contains filtered or unexported fields
}
RMultimap is the shared base for RSetMultimap / RListMultimap, wire-compatible with Redisson 4.6.x:
HASH {name} field = codec(JSON) key, value = internal id
SET/LIST {name}:{id} per-key collection
The internal id is deterministic: HighwayHash-128 (Redisson fixed key) over the codec-encoded key, packed big-endian, unpadded base64 — matching Java's Hash.hash128toBase64 byte-for-byte (redi.py-verified).
func (*RMultimap) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RMultimap) ContainsEntry ¶
ContainsEntry reports whether (key, value) is associated.
func (*RMultimap) ContainsKey ¶
ContainsKey reports whether key has any association.
func (*RMultimap) ContainsValue ¶ added in v0.2.13
ContainsValue reports whether any key is associated with value.
func (*RMultimap) Entries ¶ added in v0.2.13
func (m *RMultimap) Entries(ctx context.Context) ([]MultimapEntry, error)
Entries returns every key/value association.
func (*RMultimap) FastRemove ¶ added in v0.2.13
FastRemove drops keys and their value collections in one operation.
func (*RMultimap) FastRemoveValue ¶ added in v0.2.13
FastRemoveValue removes one occurrence of each value from every key.
func (*RMultimap) FastReplaceValues ¶ added in v0.2.13
FastReplaceValues replaces all values associated with key without returning the old values.
func (*RMultimap) GetFairLock ¶ added in v0.2.13
GetFairLock returns the Redisson fair lock associated with a multimap key.
func (*RMultimap) GetLock ¶ added in v0.2.13
GetLock returns the Redisson lock associated with a multimap key.
func (*RMultimap) GetReadWriteLock ¶ added in v0.2.13
func (m *RMultimap) GetReadWriteLock(key any) *RReadWriteLock
GetReadWriteLock returns the Redisson read-write lock for a multimap key.
func (*RMultimap) GetSemaphore ¶ added in v0.2.13
func (m *RMultimap) GetSemaphore(key any) *RSemaphore
GetSemaphore returns the Redisson semaphore associated with a multimap key.
func (*RMultimap) IsEmpty ¶ added in v0.2.13
IsEmpty reports whether the multimap has no associations.
func (*RMultimap) KeySize ¶ added in v0.2.13
KeySize returns the number of keys in the multimap index.
func (*RMultimap) Name ¶
func (o *RMultimap) Name() string
Name returns the Redis key name of the object.
func (*RMultimap) Put ¶
Put associates value with key. Returns true when a new association was created.
func (*RMultimap) ReadAllKeySet ¶ added in v0.2.13
ReadAllKeySet is the eager KeySet alias used by Redisson.
func (*RMultimap) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RMultimap) RemoveEntry ¶
RemoveEntry removes one association (key, value). When the collection becomes empty it is deleted along with the hash entry.
func (*RMultimap) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RMultimap) ReplaceValues ¶ added in v0.2.13
ReplaceValues replaces all values associated with key and returns the old values.
type RNonReentrantFairLock ¶ added in v0.2.13
type RNonReentrantFairLock struct {
*RFairLock
}
RNonReentrantFairLock is Redisson's FIFO lock variant that rejects a second acquisition by its current holder with ErrLockReentrant.
func (RNonReentrantFairLock) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (RNonReentrantFairLock) Name ¶ added in v0.2.13
func (o RNonReentrantFairLock) Name() string
Name returns the Redis key name of the object.
func (RNonReentrantFairLock) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (RNonReentrantFairLock) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
type RNonReentrantLock ¶ added in v0.2.13
type RNonReentrantLock struct {
// contains filtered or unexported fields
}
RNonReentrantLock is a distributed lock that refuses re-entry by the same holder (Redisson NonReentrantLock). HASH field still stores the holder id with count always 1.
func (*RNonReentrantLock) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (*RNonReentrantLock) ForceUnlock ¶ added in v0.2.13
func (l *RNonReentrantLock) ForceUnlock(ctx context.Context) (bool, error)
ForceUnlock deletes the lock regardless of owner and wakes waiters.
func (*RNonReentrantLock) IsHeldBy ¶ added in v0.2.13
IsHeldBy reports whether clientID holds the lock.
func (*RNonReentrantLock) IsLocked ¶ added in v0.2.13
func (l *RNonReentrantLock) IsLocked(ctx context.Context) (bool, error)
IsLocked reports whether anyone holds the lock.
func (*RNonReentrantLock) Name ¶ added in v0.2.13
func (o *RNonReentrantLock) Name() string
Name returns the Redis key name of the object.
func (*RNonReentrantLock) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RNonReentrantLock) RemainTimeToLive ¶ added in v0.2.13
RemainTimeToLive returns the remaining lock lease.
func (*RNonReentrantLock) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RNonReentrantLock) TryLock ¶ added in v0.2.13
func (l *RNonReentrantLock) TryLock(ctx context.Context, clientID string, ttl time.Duration) (bool, error)
TryLock attempts one acquisition.
func (*RNonReentrantLock) TryLockWait ¶ added in v0.2.13
func (l *RNonReentrantLock) TryLockWait(ctx context.Context, clientID string, wait, ttl time.Duration) (bool, error)
TryLockWait waits up to wait for the lock.
type RPatternTopic ¶
type RPatternTopic struct {
// contains filtered or unexported fields
}
RPatternTopic subscribes to a glob pattern (PSUBSCRIBE).
func (*RPatternTopic) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RPatternTopic) CountListeners ¶ added in v0.2.13
func (t *RPatternTopic) CountListeners() int
CountListeners returns the number of local pattern listeners.
func (*RPatternTopic) Name ¶
func (o *RPatternTopic) Name() string
Name returns the Redis key name of the object.
func (*RPatternTopic) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RPatternTopic) RemoveAllListeners ¶ added in v0.2.13
func (t *RPatternTopic) RemoveAllListeners()
RemoveAllListeners unregisters every local pattern listener.
func (*RPatternTopic) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RPatternTopic) Subscribe ¶
func (t *RPatternTopic) Subscribe(listener func(channel string, msg any)) (int, error)
Subscribe registers a pattern listener, blocking until confirmed.
func (*RPatternTopic) Unsubscribe ¶
func (t *RPatternTopic) Unsubscribe(id int) bool
Unsubscribe removes a pattern listener.
type RPermitExpirableSemaphore ¶ added in v0.2.4
type RPermitExpirableSemaphore struct {
// contains filtered or unexported fields
}
RPermitExpirableSemaphore is a semaphore whose permits are individually leased and expire on their own, wire-compatible with Redisson's RedissonPermitExpirableSemaphore:
STRING {name} available permit counter
ZSET {name}:timeout issued permits (member = opaque permit id,
score = absolute expiry epoch ms)
PUBSUB redisson_sc:{name} release wake-up channel
Each acquire returns a unique permit id; only that id can release the permit. Expired permits are reclaimed into the pool atomically on the next acquire (Lua).
func (*RPermitExpirableSemaphore) Acquire ¶ added in v0.2.4
func (s *RPermitExpirableSemaphore) Acquire(ctx context.Context, lease time.Duration) (string, error)
Acquire blocks until a permit is leased or ctx ends (ErrNoPermit). Wakes on release via the redisson_sc channel with a 1s fallback.
func (*RPermitExpirableSemaphore) AcquireN ¶ added in v0.2.13
func (s *RPermitExpirableSemaphore) AcquireN( ctx context.Context, permits int, lease time.Duration, ) ([]string, error)
AcquireN blocks until all requested permits can be leased atomically.
func (*RPermitExpirableSemaphore) AcquiredPermits ¶ added in v0.2.4
func (s *RPermitExpirableSemaphore) AcquiredPermits(ctx context.Context) (int64, error)
AcquiredPermits returns the currently leased permit count.
func (*RPermitExpirableSemaphore) AddPermits ¶ added in v0.2.13
func (s *RPermitExpirableSemaphore) AddPermits(ctx context.Context, permits int64) error
AddPermits adjusts the available counter by permits.
func (*RPermitExpirableSemaphore) AvailablePermits ¶ added in v0.2.4
func (s *RPermitExpirableSemaphore) AvailablePermits(ctx context.Context) (int64, error)
AvailablePermits returns the free permit count.
func (*RPermitExpirableSemaphore) ClearExpire ¶ added in v0.2.4
ClearExpire removes the TTL (key becomes persistent).
func (*RPermitExpirableSemaphore) Delete ¶ added in v0.2.4
func (s *RPermitExpirableSemaphore) Delete(ctx context.Context) error
Delete removes the counter and the permit zset.
func (*RPermitExpirableSemaphore) GetPermits ¶ added in v0.2.13
func (s *RPermitExpirableSemaphore) GetPermits(ctx context.Context) (int64, error)
GetPermits returns the configured pool size (available plus acquired).
func (*RPermitExpirableSemaphore) LeaseTime ¶ added in v0.2.4
func (s *RPermitExpirableSemaphore) LeaseTime(ctx context.Context, permitID string) (time.Duration, error)
LeaseTime returns the remaining lease of a permit (-1 when unknown).
func (*RPermitExpirableSemaphore) Name ¶ added in v0.2.4
func (o *RPermitExpirableSemaphore) Name() string
Name returns the Redis key name of the object.
func (*RPermitExpirableSemaphore) Release ¶ added in v0.2.4
Release returns a leased permit. Returns false for an unknown or expired permit id.
func (*RPermitExpirableSemaphore) ReleaseAll ¶ added in v0.2.13
func (s *RPermitExpirableSemaphore) ReleaseAll(ctx context.Context, permitIDs ...string) (int64, error)
ReleaseAll returns all known permit ids and reports how many were released.
func (*RPermitExpirableSemaphore) RemainTTL ¶ added in v0.2.4
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RPermitExpirableSemaphore) Rename ¶ added in v0.2.4
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RPermitExpirableSemaphore) SetPermits ¶ added in v0.2.13
func (s *RPermitExpirableSemaphore) SetPermits(ctx context.Context, permits int64) error
SetPermits changes the configured pool size while preserving acquisitions.
func (*RPermitExpirableSemaphore) Touch ¶ added in v0.2.4
Touch updates the last-access time of the key.
func (*RPermitExpirableSemaphore) TryAcquire ¶ added in v0.2.4
func (s *RPermitExpirableSemaphore) TryAcquire(ctx context.Context, lease time.Duration) (string, error)
TryAcquire leases one permit for lease duration, returning its id ("" when none available).
func (*RPermitExpirableSemaphore) TryAcquireN ¶ added in v0.2.13
func (s *RPermitExpirableSemaphore) TryAcquireN( ctx context.Context, permits int, lease time.Duration, ) ([]string, error)
TryAcquireN atomically leases permits, returning an empty slice when the requested number isn't available.
func (*RPermitExpirableSemaphore) TryAcquireWait ¶ added in v0.2.13
func (s *RPermitExpirableSemaphore) TryAcquireWait( ctx context.Context, lease, wait time.Duration, ) (string, error)
TryAcquireWait waits up to wait for one permit, returning an empty id on timeout.
func (*RPermitExpirableSemaphore) TrySetPermits ¶ added in v0.2.4
TrySetPermits initializes the counter only when it does not exist.
func (*RPermitExpirableSemaphore) Unlink ¶ added in v0.2.4
Unlink removes the key asynchronously (non-blocking Redis UNLINK).
func (*RPermitExpirableSemaphore) UpdateLeaseTime ¶ added in v0.2.4
func (s *RPermitExpirableSemaphore) UpdateLeaseTime(ctx context.Context, permitID string, lease time.Duration) (bool, error)
UpdateLeaseTime extends (or shortens) a permit's lease. Returns false for an unknown permit.
type RPriorityBlockingDeque ¶ added in v0.2.13
type RPriorityBlockingDeque struct {
*RPriorityBlockingQueue
}
RPriorityBlockingDeque adds highest-score (tail) blocking pops via BZPOPMAX. Still ZSET+score semantics — not Java Comparator RPriorityBlockingDeque.
func (RPriorityBlockingDeque) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (RPriorityBlockingDeque) Name ¶ added in v0.2.13
func (o RPriorityBlockingDeque) Name() string
Name returns the Redis key name of the object.
func (*RPriorityBlockingDeque) PollLastWithTimeout ¶ added in v0.2.13
func (q *RPriorityBlockingDeque) PollLastWithTimeout(ctx context.Context, timeout time.Duration) (any, error)
PollLastWithTimeout blocks up to timeout for the highest-score element.
func (RPriorityBlockingDeque) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (RPriorityBlockingDeque) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RPriorityBlockingDeque) TakeLast ¶ added in v0.2.13
func (q *RPriorityBlockingDeque) TakeLast(ctx context.Context) (any, error)
TakeLast blocks for the highest-score element (BZPOPMAX).
type RPriorityBlockingQueue ¶ added in v0.2.13
type RPriorityBlockingQueue struct {
*RPriorityQueue
}
RPriorityBlockingQueue is a blocking wrapper over RPriorityQueue (ZSET + BZPOPMIN). Same compatibility caveat as RPriorityQueue: NOT Java Comparator-based RPriorityBlockingQueue.
func (RPriorityBlockingQueue) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (RPriorityBlockingQueue) Name ¶ added in v0.2.13
func (o RPriorityBlockingQueue) Name() string
Name returns the Redis key name of the object.
func (*RPriorityBlockingQueue) PollWithTimeout ¶ added in v0.2.13
func (q *RPriorityBlockingQueue) PollWithTimeout(ctx context.Context, timeout time.Duration) (any, error)
PollWithTimeout blocks up to timeout for the lowest-score element. Returns (nil, nil) on timeout.
func (RPriorityBlockingQueue) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (RPriorityBlockingQueue) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RPriorityBlockingQueue) Take ¶ added in v0.2.13
func (q *RPriorityBlockingQueue) Take(ctx context.Context) (any, error)
Take blocks until an element is available (BZPOPMIN timeout 0) or ctx ends.
type RPriorityDeque ¶ added in v0.2.13
type RPriorityDeque struct {
*RPriorityQueue
}
RPriorityDeque is a non-blocking double-ended view of the same ZSET priority queue (ZPOPMIN / ZPOPMAX). Not Java Comparator RPriorityDeque.
func (RPriorityDeque) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (RPriorityDeque) Name ¶ added in v0.2.13
func (o RPriorityDeque) Name() string
Name returns the Redis key name of the object.
func (*RPriorityDeque) PeekFirst ¶ added in v0.2.13
func (q *RPriorityDeque) PeekFirst(ctx context.Context) (any, error)
PeekFirst returns the lowest-score element without removing it (alias of Peek).
func (*RPriorityDeque) PeekLast ¶ added in v0.2.13
func (q *RPriorityDeque) PeekLast(ctx context.Context) (any, error)
PeekLast returns the highest-score element without removing it.
func (*RPriorityDeque) PollFirst ¶ added in v0.2.13
func (q *RPriorityDeque) PollFirst(ctx context.Context) (any, error)
PollFirst removes and returns the lowest-score element (alias of Poll).
func (*RPriorityDeque) PollLast ¶ added in v0.2.13
func (q *RPriorityDeque) PollLast(ctx context.Context) (any, error)
PollLast removes and returns the highest-score element.
func (RPriorityDeque) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (RPriorityDeque) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
type RPriorityQueue ¶ added in v0.2.6
type RPriorityQueue struct {
// contains filtered or unexported fields
}
RPriorityQueue is a ZSET-backed priority queue: lower score is polled first. Members are codec-encoded.
Compatibility note: this is NOT Redisson's RPriorityQueue (LIST + Comparator). Java getPriorityQueue() will not interoperate with this structure. Use it as a Redis-native scored priority queue, or read the same ZSET via RScoredSortedSet / raw Redis.
func (*RPriorityQueue) Clear ¶ added in v0.2.6
func (q *RPriorityQueue) Clear(ctx context.Context) error
Clear removes the queue.
func (*RPriorityQueue) ClearExpire ¶ added in v0.2.6
ClearExpire removes the TTL (key becomes persistent).
func (*RPriorityQueue) Name ¶ added in v0.2.6
func (o *RPriorityQueue) Name() string
Name returns the Redis key name of the object.
func (*RPriorityQueue) Peek ¶ added in v0.2.6
func (q *RPriorityQueue) Peek(ctx context.Context) (any, error)
Peek returns the highest-priority element without removing it.
func (*RPriorityQueue) PeekScore ¶ added in v0.2.6
PeekScore returns the priority of an element (ok=false when absent).
func (*RPriorityQueue) Poll ¶ added in v0.2.6
func (q *RPriorityQueue) Poll(ctx context.Context) (any, error)
Poll removes and returns the highest-priority element (lowest score). Returns (nil, nil) when empty.
func (*RPriorityQueue) RemainTTL ¶ added in v0.2.6
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RPriorityQueue) Remove ¶ added in v0.2.6
func (q *RPriorityQueue) Remove(ctx context.Context, element any) error
Remove deletes an element.
func (*RPriorityQueue) Rename ¶ added in v0.2.6
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RPriorityQueue) Size ¶ added in v0.2.6
func (q *RPriorityQueue) Size(ctx context.Context) (int64, error)
Size returns the number of queued elements.
type RQueue ¶
type RQueue struct {
// contains filtered or unexported fields
}
RQueue is a distributed FIFO queue backed by a Redis List. Offer appends to the tail (RPUSH) and Poll removes from the head (LPOP). Elements are codec (JSON) encoded, Redisson-compatible.
func (*RQueue) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RQueue) Peek ¶
Peek returns the head element without removing it. Returns (nil, nil) when the queue is empty.
func (*RQueue) PeekInto ¶ added in v0.2.13
PeekInto decodes the head into target without removing it. Returns false when the queue is empty.
func (*RQueue) Poll ¶
Poll removes and returns the head element. Returns (nil, nil) when the queue is empty.
func (*RQueue) PollInto ¶ added in v0.2.13
PollInto removes the head and decodes it into target. Returns false when the queue is empty.
func (*RQueue) ReadAll ¶ added in v0.2.13
ReadAll returns all elements without removing them (LRANGE 0 -1).
func (*RQueue) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RQueue) Take ¶
Take blocks until an element is available or ctx is cancelled, then removes and returns it. Sub-second timeouts are rounded up to 1s (BLPOP has second granularity).
type RRateLimiter ¶
type RRateLimiter struct {
// contains filtered or unexported fields
}
RRateLimiter is a distributed sliding-window rate limiter, wire-compatible with Redisson 4.6.x:
HASH {name} config: rate, interval (ms), keepAliveTime, type
STRING {name}:value remaining permits in the window
ZSET {name}:permits claims: score = claim ts(ms),
member = 0x10 + 16B client UUID + LE uint32 permits
PER_CLIENT appends the client id to the value/permits keys.
Example ¶
package main
import (
"context"
"fmt"
"time"
redi "github.com/linkerlin/redi.go"
)
func main() {
client, err := redi.NewClient(redi.DefaultConfig())
if err != nil {
fmt.Println("skip:", err)
return
}
defer client.Close() //nolint:errcheck // example
ctx := context.Background()
// Config is persisted in Redis: every process sharing the name
// shares the same sliding window. (Self-cleanup INCLUDING the
// companion keys keeps the example re-runnable.)
_, _ = client.GetKeys().Delete(ctx, "demo:api", "{demo:api}:value", "{demo:api}:permits")
rl := client.GetRateLimiter("demo:api")
_, _ = rl.TrySetRate(ctx, redi.RateTypeOverall, 2, time.Minute)
first, _ := rl.TryAcquire(ctx, 1)
second, _ := rl.TryAcquire(ctx, 1)
third, _ := rl.TryAcquire(ctx, 1)
fmt.Println(first, second, third)
}
Output: true true false
func (*RRateLimiter) Acquire ¶
func (r *RRateLimiter) Acquire(ctx context.Context, permits int64) error
Acquire blocks until permits are granted or ctx is cancelled.
func (*RRateLimiter) AvailablePermits ¶
func (r *RRateLimiter) AvailablePermits(ctx context.Context) (int64, error)
AvailablePermits returns the permits currently available in the window.
func (*RRateLimiter) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RRateLimiter) Delete ¶
func (r *RRateLimiter) Delete(ctx context.Context) error
Delete removes config, value and permits keys.
func (*RRateLimiter) GetConfig ¶ added in v0.2.13
func (r *RRateLimiter) GetConfig(ctx context.Context) (RateLimiterConfig, error)
GetConfig loads the persisted config from Redis (empty when unset).
func (*RRateLimiter) Name ¶
func (o *RRateLimiter) Name() string
Name returns the Redis key name of the object.
func (*RRateLimiter) Release ¶ added in v0.2.13
func (r *RRateLimiter) Release(ctx context.Context, permits int64) error
Release returns permits to the pool immediately (capped at rate), without waiting for the sliding window to expire — Redisson release(permits).
func (*RRateLimiter) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RRateLimiter) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RRateLimiter) SetRate ¶
func (r *RRateLimiter) SetRate(ctx context.Context, rateType RateType, rate int64, interval time.Duration) error
SetRate (over)writes the persisted rate config.
func (*RRateLimiter) SetRateWithKeepAlive ¶ added in v0.2.13
func (r *RRateLimiter) SetRateWithKeepAlive( ctx context.Context, rateType RateType, rate int64, interval, keepAlive time.Duration, ) error
SetRateWithKeepAlive writes rate config and optional keepAlive TTL on the config HASH and active value/permits keys (Redisson keepAliveTime).
func (*RRateLimiter) TryAcquire ¶
TryAcquire takes permits when the window allows it.
func (*RRateLimiter) TryAcquireWait ¶ added in v0.2.13
func (r *RRateLimiter) TryAcquireWait( ctx context.Context, permits int64, wait time.Duration, ) (bool, error)
TryAcquireWait waits up to wait for permits to become available.
func (*RRateLimiter) TrySetRate ¶
func (r *RRateLimiter) TrySetRate(ctx context.Context, rateType RateType, rate int64, interval time.Duration) (bool, error)
TrySetRate sets the rate config only when not yet configured.
func (*RRateLimiter) TrySetRateWithKeepAlive ¶ added in v0.2.13
func (r *RRateLimiter) TrySetRateWithKeepAlive( ctx context.Context, rateType RateType, rate int64, interval, keepAlive time.Duration, ) (bool, error)
TrySetRateWithKeepAlive is TrySetRate plus config/companion TTL (Java keepAliveTime).
type RReadWriteLock ¶
type RReadWriteLock struct {
// contains filtered or unexported fields
}
RReadWriteLock is a distributed read-write lock using a single Redis HASH (wire-compatible with Redisson's RedissonReadWriteLock layout):
HASH {name}
mode = "read" | "write" | "read-write"
{clientID} = read-lock hold count
{clientID}:write = write-lock hold count
All acquire/release paths are atomic Lua. Channel redisson_rwlock:{name} wakes waiters on full release (message 0 after write release, 1 after read release, matching Redisson's LockPubSub messages).
Unlike RLock there is no watchdog: leases expire after the TTL (30s default).
func (*RReadWriteLock) ReadLock ¶
func (l *RReadWriteLock) ReadLock() *RReadWriteSubLock
ReadLock returns the read (shared) lock view.
func (*RReadWriteLock) WriteLock ¶
func (l *RReadWriteLock) WriteLock() *RReadWriteSubLock
WriteLock returns the write (exclusive) lock view.
type RReadWriteSubLock ¶
type RReadWriteSubLock struct {
// contains filtered or unexported fields
}
RReadWriteSubLock is either the read or the write half of an RReadWriteLock.
func (*RReadWriteSubLock) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RReadWriteSubLock) ForceUnlock ¶
func (s *RReadWriteSubLock) ForceUnlock(ctx context.Context) (bool, error)
ForceUnlock deletes the lock key and wakes all waiters.
func (*RReadWriteSubLock) HoldCount ¶ added in v0.2.13
HoldCount returns the re-entrancy count held by clientID.
func (*RReadWriteSubLock) IsLocked ¶
func (s *RReadWriteSubLock) IsLocked(ctx context.Context) (bool, error)
IsLocked reports whether this half is held (write half checks the mode).
func (*RReadWriteSubLock) Name ¶
func (o *RReadWriteSubLock) Name() string
Name returns the Redis key name of the object.
func (*RReadWriteSubLock) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RReadWriteSubLock) RemainTimeToLive ¶ added in v0.2.13
RemainTimeToLive returns the remaining lease for the shared lock key.
func (*RReadWriteSubLock) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RReadWriteSubLock) TryLock ¶
func (s *RReadWriteSubLock) TryLock(ctx context.Context, clientID string, ttl time.Duration) (bool, error)
TryLock attempts one acquisition. With ttl <= 0 the watchdog renews the lease (see Lock).
func (*RReadWriteSubLock) TryLockWait ¶ added in v0.2.13
func (s *RReadWriteSubLock) TryLockWait( ctx context.Context, clientID string, wait, ttl time.Duration, ) (bool, error)
TryLockWait tries to acquire until wait elapses or ctx is cancelled.
type RRedLock ¶ added in v0.2.13
type RRedLock struct {
// contains filtered or unexported fields
}
RRedLock implements RedissonRedLock's majority policy over independent RLock members. Members may belong to different Client instances.
func (*RRedLock) Lock ¶ added in v0.2.13
Lock acquires a strict majority or returns ErrRedLockFailed when wait elapses. Context cancellation is returned unchanged.
func (*RRedLock) TryLock ¶ added in v0.2.13
func (r *RRedLock) TryLock( ctx context.Context, clientID string, ttl time.Duration, ) (bool, error)
TryLock attempts every member once and succeeds when a strict majority is acquired. A failed minority is tolerated; failure rolls back acquired locks.
func (*RRedLock) TryLockWait ¶ added in v0.2.13
func (r *RRedLock) TryLockWait( ctx context.Context, clientID string, wait, ttl time.Duration, ) (bool, error)
TryLockWait attempts to acquire a strict majority within wait. Like RedissonRedLock, each member receives at most remain/len(locks) wait time.
type RRedisNodes ¶ added in v0.2.13
type RRedisNodes struct {
// contains filtered or unexported fields
}
RRedisNodes is a thin topology probe analogous to Redisson getRedisNodes.
func (*RRedisNodes) Info ¶ added in v0.2.13
func (n *RRedisNodes) Info(ctx context.Context) (string, error)
Info returns INFO server section (best-effort; cluster returns one node).
func (*RRedisNodes) Mode ¶ added in v0.2.13
func (n *RRedisNodes) Mode() Mode
Mode returns the configured topology.
func (*RRedisNodes) Ping ¶ added in v0.2.13
func (n *RRedisNodes) Ping(ctx context.Context) error
Ping checks connectivity.
func (*RRedisNodes) String ¶ added in v0.2.13
func (n *RRedisNodes) String() string
String describes the mode and addresses.
type RReliableTopic ¶ added in v0.2.4
type RReliableTopic struct {
// contains filtered or unexported fields
}
RReliableTopic is a reliable pub/sub topic backed by a Redis Stream, wire-compatible with Redisson's RedissonReliableTopic (source-verified):
STREAM {name} messages: XADD field "m" = codec-encoded payload
GROUP {subscriberId} ONE CONSUMER GROUP PER SUBSCRIBER (Java
semantics: every group receives every message —
unlike one-group-many-consumers, which would
load-balance instead of broadcasting)
ZSET {name}:timeout subscriber liveness (watchdog deadline, score=ts)
Messages are acked only after the listener returns, so a crash mid-callback redelivers (reliable delivery).
func (*RReliableTopic) ClearExpire ¶ added in v0.2.4
ClearExpire removes the TTL (key becomes persistent).
func (*RReliableTopic) CountListeners ¶ added in v0.2.13
func (t *RReliableTopic) CountListeners() int
CountListeners returns the number of local reliable listeners.
func (*RReliableTopic) CountSubscribers ¶ added in v0.2.4
func (t *RReliableTopic) CountSubscribers(ctx context.Context) (int64, error)
CountSubscribers returns the number of active subscriber groups.
func (*RReliableTopic) Delete ¶ added in v0.2.4
func (t *RReliableTopic) Delete(ctx context.Context) error
Delete stops all listeners and removes the topic, its timeout zset and every subscriber group.
func (*RReliableTopic) Name ¶ added in v0.2.4
func (o *RReliableTopic) Name() string
Name returns the Redis key name of the object.
func (*RReliableTopic) Publish ¶ added in v0.2.4
Publish appends a message for every subscriber group (XADD field "m"). Returns the number of subscriber groups (Java semantics: XINFO GROUPS).
func (*RReliableTopic) RemainTTL ¶ added in v0.2.4
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RReliableTopic) RemoveAllListeners ¶ added in v0.2.13
func (t *RReliableTopic) RemoveAllListeners()
RemoveAllListeners unregisters every local listener and subscriber group.
func (*RReliableTopic) Rename ¶ added in v0.2.4
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RReliableTopic) Size ¶ added in v0.2.4
func (t *RReliableTopic) Size(ctx context.Context) (int64, error)
Size returns the number of messages in the stream.
func (*RReliableTopic) Subscribe ¶ added in v0.2.4
func (t *RReliableTopic) Subscribe(listener func(msg any)) (string, error)
Subscribe registers a listener that receives every message (its own consumer group, from the beginning of the stream like Java's StreamMessageId.ALL). Blocks until the group is created.
func (*RReliableTopic) Unlink ¶ added in v0.2.4
Unlink removes the key asynchronously (non-blocking Redis UNLINK).
func (*RReliableTopic) Unsubscribe ¶ added in v0.2.4
func (t *RReliableTopic) Unsubscribe(id string)
Unsubscribe stops a listener and removes its group and liveness entry.
type RRingBuffer ¶ added in v0.2.12
type RRingBuffer struct {
// contains filtered or unexported fields
}
RRingBuffer is a capacity-bounded FIFO that evicts the oldest element on overflow, wire-compatible with Redisson's RedissonRingBuffer:
LIST {name} elements (RPUSH tail, LPOP on overflow)
STRING redisson_rb:{name} capacity (plain decimal, SETNX)
func (*RRingBuffer) Add ¶ added in v0.2.12
func (r *RRingBuffer) Add(ctx context.Context, value any) error
Add appends an element, evicting the oldest on overflow.
func (*RRingBuffer) AddAll ¶ added in v0.2.12
func (r *RRingBuffer) AddAll(ctx context.Context, values ...any) error
AddAll appends multiple elements, trimming to capacity in one pass.
func (*RRingBuffer) Capacity ¶ added in v0.2.12
func (r *RRingBuffer) Capacity(ctx context.Context) (int64, error)
Capacity returns the configured capacity (0 when undefined).
func (*RRingBuffer) Clear ¶ added in v0.2.13
func (r *RRingBuffer) Clear(ctx context.Context) error
Clear removes queued elements while preserving the configured capacity.
func (*RRingBuffer) ClearExpire ¶ added in v0.2.12
ClearExpire removes the TTL (key becomes persistent).
func (*RRingBuffer) Delete ¶ added in v0.2.12
func (r *RRingBuffer) Delete(ctx context.Context) error
Delete removes the buffer and its settings key.
func (*RRingBuffer) Name ¶ added in v0.2.12
func (o *RRingBuffer) Name() string
Name returns the Redis key name of the object.
func (*RRingBuffer) Offer ¶ added in v0.2.13
func (r *RRingBuffer) Offer(ctx context.Context, value any) error
Offer is the queue-style alias of Add.
func (*RRingBuffer) Peek ¶ added in v0.2.13
func (r *RRingBuffer) Peek(ctx context.Context) (any, error)
Peek returns the oldest element without removing it.
func (*RRingBuffer) Poll ¶ added in v0.2.13
func (r *RRingBuffer) Poll(ctx context.Context) (any, error)
Poll removes and returns the oldest element, or (nil, nil) when empty.
func (*RRingBuffer) ReadAll ¶ added in v0.2.13
func (r *RRingBuffer) ReadAll(ctx context.Context) ([]any, error)
ReadAll returns all elements from oldest to newest.
func (*RRingBuffer) ReadNewest ¶ added in v0.2.12
ReadNewest returns up to count elements from the tail (newest last, same relative order as stored — matching Java's range(-count, -1)).
func (*RRingBuffer) ReadOldest ¶ added in v0.2.12
ReadOldest returns up to count elements from the head (oldest first).
func (*RRingBuffer) RemainTTL ¶ added in v0.2.12
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RRingBuffer) RemainingCapacity ¶ added in v0.2.12
func (r *RRingBuffer) RemainingCapacity(ctx context.Context) (int64, error)
RemainingCapacity returns capacity minus current size (>= 0).
func (*RRingBuffer) Rename ¶ added in v0.2.12
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RRingBuffer) SetCapacity ¶ added in v0.2.12
func (r *RRingBuffer) SetCapacity(ctx context.Context, capacity int64) error
func (*RRingBuffer) Size ¶ added in v0.2.12
func (r *RRingBuffer) Size(ctx context.Context) (int64, error)
Size returns the current number of elements.
func (*RRingBuffer) TrySetCapacity ¶ added in v0.2.12
TrySetCapacity initializes the capacity only when undefined.
type RScoredSortedSet ¶
type RScoredSortedSet struct {
// contains filtered or unexported fields
}
RScoredSortedSet is a distributed sorted set backed by a Redis ZSET. Members are codec (JSON) encoded; scores are float64.
func (*RScoredSortedSet) AddAllIfAbsent ¶ added in v0.2.13
func (s *RScoredSortedSet) AddAllIfAbsent( ctx context.Context, entries map[any]float64, ) (int64, error)
AddAllIfAbsent adds only members that aren't already present.
func (*RScoredSortedSet) AddAndGetRank ¶ added in v0.2.13
func (s *RScoredSortedSet) AddAndGetRank( ctx context.Context, member any, score float64, ) (int64, error)
AddAndGetRank sets score and returns the member's ascending rank.
func (*RScoredSortedSet) AddIfAbsent ¶ added in v0.2.13
func (s *RScoredSortedSet) AddIfAbsent(ctx context.Context, member any, score float64) (bool, error)
AddIfAbsent adds member only when it isn't present.
func (*RScoredSortedSet) AddIfExists ¶ added in v0.2.13
func (s *RScoredSortedSet) AddIfExists(ctx context.Context, member any, score float64) (bool, error)
AddIfExists updates an existing member and reports whether its score changed.
func (*RScoredSortedSet) AddIfGreater ¶ added in v0.2.13
func (s *RScoredSortedSet) AddIfGreater( ctx context.Context, member any, score float64, ) (bool, error)
AddIfGreater adds a missing member or updates it only when score is greater.
func (*RScoredSortedSet) AddIfLess ¶ added in v0.2.13
func (s *RScoredSortedSet) AddIfLess( ctx context.Context, member any, score float64, ) (bool, error)
AddIfLess adds a missing member or updates it only when score is lower.
func (*RScoredSortedSet) AddScore ¶
func (s *RScoredSortedSet) AddScore(ctx context.Context, member any, delta float64) (float64, error)
AddScore adds delta to member's score and returns the new score.
func (*RScoredSortedSet) AddScoreAndGetRank ¶ added in v0.2.13
func (s *RScoredSortedSet) AddScoreAndGetRank( ctx context.Context, member any, delta float64, ) (int64, error)
AddScoreAndGetRank increments score and returns the new ascending rank.
func (*RScoredSortedSet) Clear ¶
func (s *RScoredSortedSet) Clear(ctx context.Context) error
Clear removes all members.
func (*RScoredSortedSet) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RScoredSortedSet) Diff ¶ added in v0.2.13
Diff returns members present in this sorted set but absent from all named sorted sets.
func (*RScoredSortedSet) DiffStore ¶ added in v0.2.13
func (s *RScoredSortedSet) DiffStore( ctx context.Context, dest string, otherNames ...string, ) (int64, error)
DiffStore stores the difference in dest and returns its size.
func (*RScoredSortedSet) EntryRange ¶ added in v0.2.13
EntryRange returns member/score pairs by ascending rank.
func (*RScoredSortedSet) First ¶ added in v0.2.13
func (s *RScoredSortedSet) First(ctx context.Context) (any, error)
First returns the lowest-score member without removing it.
func (*RScoredSortedSet) FirstEntry ¶ added in v0.2.13
FirstEntry returns the lowest-score member and score, or nil when empty.
func (*RScoredSortedSet) FirstScore ¶ added in v0.2.13
func (s *RScoredSortedSet) FirstScore(ctx context.Context) (float64, error)
FirstScore returns the lowest score, or 0 when empty.
func (*RScoredSortedSet) Intersection ¶ added in v0.2.13
Intersection returns members present in this sorted set and every named sorted set. Redis sums scores when determining the result ordering.
func (*RScoredSortedSet) IntersectionStore ¶ added in v0.2.13
func (s *RScoredSortedSet) IntersectionStore( ctx context.Context, dest string, otherNames ...string, ) (int64, error)
IntersectionStore stores the intersection in dest and returns its size.
func (*RScoredSortedSet) Last ¶ added in v0.2.13
func (s *RScoredSortedSet) Last(ctx context.Context) (any, error)
Last returns the highest-score member without removing it.
func (*RScoredSortedSet) LastEntry ¶ added in v0.2.13
LastEntry returns the highest-score member and score, or nil when empty.
func (*RScoredSortedSet) LastScore ¶ added in v0.2.13
func (s *RScoredSortedSet) LastScore(ctx context.Context) (float64, error)
LastScore returns the highest score, or 0 when empty.
func (*RScoredSortedSet) Name ¶
func (o *RScoredSortedSet) Name() string
Name returns the Redis key name of the object.
func (*RScoredSortedSet) PollFirst ¶ added in v0.2.13
func (s *RScoredSortedSet) PollFirst(ctx context.Context) (any, error)
PollFirst removes and returns the lowest-score member.
func (*RScoredSortedSet) PollFirstEntries ¶ added in v0.2.13
PollFirstEntries removes and returns up to count lowest-score entries.
func (*RScoredSortedSet) PollLast ¶ added in v0.2.13
func (s *RScoredSortedSet) PollLast(ctx context.Context) (any, error)
PollLast removes and returns the highest-score member.
func (*RScoredSortedSet) PollLastEntries ¶ added in v0.2.13
PollLastEntries removes and returns up to count highest-score entries in ascending score order, matching Redisson's zrange(-count, -1) result.
func (*RScoredSortedSet) Random ¶ added in v0.2.13
func (s *RScoredSortedSet) Random(ctx context.Context) (any, error)
Random returns one random member, or nil when empty.
func (*RScoredSortedSet) RandomN ¶ added in v0.2.13
RandomN returns random members using Redis ZRANDMEMBER count semantics.
func (*RScoredSortedSet) Range ¶
Range returns members in ascending rank order within [start, stop].
func (*RScoredSortedSet) RangeByScore ¶
RangeByScore returns members with min <= score <= max, ascending.
func (*RScoredSortedSet) RangeReversed ¶ added in v0.2.13
RangeReversed returns members in descending rank order within [start, stop].
func (*RScoredSortedSet) RangeWithScores ¶
func (s *RScoredSortedSet) RangeWithScores(ctx context.Context, start, stop int64) ([]redis.Z, error)
RangeWithScores returns member/score pairs within [start, stop].
func (*RScoredSortedSet) Rank ¶
Rank returns the 0-based ascending rank. Returns (-1, nil) when absent.
func (*RScoredSortedSet) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RScoredSortedSet) Remove ¶
func (s *RScoredSortedSet) Remove(ctx context.Context, members ...any) error
Remove removes members.
func (*RScoredSortedSet) RemoveRangeByRank ¶ added in v0.2.13
RemoveRangeByRank removes members with ranks in [start, stop].
func (*RScoredSortedSet) RemoveRangeByScore ¶ added in v0.2.13
RemoveRangeByScore removes members with min <= score <= max.
func (*RScoredSortedSet) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RScoredSortedSet) RevRank ¶ added in v0.2.13
RevRank returns the 0-based descending rank. Returns (-1, nil) when absent.
func (*RScoredSortedSet) Score ¶
Score returns member's score. Returns (0, nil) when member is absent.
func (*RScoredSortedSet) Size ¶
func (s *RScoredSortedSet) Size(ctx context.Context) (int64, error)
Size returns the number of members.
func (*RScoredSortedSet) TryAdd ¶ added in v0.2.13
TryAdd is the Redisson-style alias of AddIfAbsent.
func (*RScoredSortedSet) Union ¶ added in v0.2.13
Union returns members present in this sorted set or any named sorted set. Redis sums scores for members present in multiple sets.
func (*RScoredSortedSet) UnionStore ¶ added in v0.2.13
func (s *RScoredSortedSet) UnionStore( ctx context.Context, dest string, otherNames ...string, ) (int64, error)
UnionStore stores the union in dest and returns its size.
type RScript ¶
type RScript struct {
// contains filtered or unexported fields
}
RScript evaluates Lua scripts with cached digests (EVAL/EVALSHA), mirroring Redisson's RScript.
func (*RScript) Eval ¶
func (s *RScript) Eval(ctx context.Context, script string, rt ScriptReturnType, keys []string, values ...any) (any, error)
Eval runs a script with keys and argument values, casting the reply per rt. A Lua nil reply decodes to (nil, nil).
func (*RScript) EvalSha ¶
func (s *RScript) EvalSha(ctx context.Context, sha string, rt ScriptReturnType, keys []string, values ...any) (any, error)
EvalSha runs a script by SHA digest (the script must already be loaded).
func (*RScript) ScriptExists ¶
ScriptExists reports which digests are cached on the server.
type RSearch ¶ added in v0.2.13
type RSearch struct {
// contains filtered or unexported fields
}
RSearch is a RediSearch facade (create / search / drop subset).
func (*RSearch) CreateIndex ¶ added in v0.2.13
func (s *RSearch) CreateIndex(ctx context.Context, name string, opts IndexOptions, fields ...IndexField) error
CreateIndex creates an index.
func (*RSearch) Search ¶ added in v0.2.13
func (s *RSearch) Search(ctx context.Context, name, query string, opts SearchOptions) (SearchResult, error)
Search runs FT.SEARCH.
type RSemaphore ¶
type RSemaphore struct {
// contains filtered or unexported fields
}
RSemaphore is a distributed counting semaphore backed by a Redis String (permit counter), Redisson wire-compatible: channel redisson_sc:{name} wakes blocked acquirers on release.
func (*RSemaphore) Acquire ¶
func (s *RSemaphore) Acquire(ctx context.Context, permits int64) error
Acquire blocks until permits are available or ctx is cancelled. Wakes on release via the redisson_sc channel, with a 1s fallback poll.
func (*RSemaphore) AddPermits ¶
func (s *RSemaphore) AddPermits(ctx context.Context, permits int64) error
AddPermits increases (or, when negative, decreases) the permit counter.
func (*RSemaphore) AvailablePermits ¶
func (s *RSemaphore) AvailablePermits(ctx context.Context) (int64, error)
AvailablePermits returns the current permit count (0 when uninitialized).
func (*RSemaphore) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RSemaphore) DrainPermits ¶
func (s *RSemaphore) DrainPermits(ctx context.Context) (int64, error)
DrainPermits takes all available permits and returns how many were taken.
func (*RSemaphore) Name ¶
func (o *RSemaphore) Name() string
Name returns the Redis key name of the object.
func (*RSemaphore) Release ¶
func (s *RSemaphore) Release(ctx context.Context, permits int64) error
Release returns permits and wakes blocked acquirers.
func (*RSemaphore) ReleaseIfExists ¶ added in v0.2.13
ReleaseIfExists returns permits only when the semaphore is initialized.
func (*RSemaphore) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RSemaphore) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RSemaphore) TryAcquire ¶
TryAcquire takes permits when available, returning false otherwise.
func (*RSemaphore) TryAcquireWait ¶ added in v0.2.13
func (s *RSemaphore) TryAcquireWait(ctx context.Context, permits int64, wait time.Duration) (bool, error)
TryAcquireWait tries to acquire until wait elapses or ctx is cancelled. Wakes on release via the redisson_sc channel, with a 1s fallback poll.
func (*RSemaphore) TrySetPermits ¶
TrySetPermits initializes the semaphore only when it does not exist.
type RSet ¶
type RSet struct {
// contains filtered or unexported fields
}
RSet is a distributed set backed by a Redis Set. Members are codec (JSON) encoded, Redisson-compatible.
func (*RSet) AddCounted ¶ added in v0.2.13
AddCounted adds members and returns how many were newly inserted (Redisson addAllCounted / SADD).
func (*RSet) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RSet) CountIntersection ¶ added in v0.2.13
CountIntersection returns the intersection cardinality without materializing the members.
func (*RSet) Diff ¶ added in v0.2.13
Diff returns members present in this set but absent from all named sets.
func (*RSet) DiffStore ¶ added in v0.2.13
DiffStore stores the difference in dest and returns its cardinality.
func (*RSet) GetCountDownLatch ¶ added in v0.2.13
func (s *RSet) GetCountDownLatch(value any) *RCountDownLatch
GetCountDownLatch returns the Redisson latch associated with a set value.
func (*RSet) GetFairLock ¶ added in v0.2.13
GetFairLock returns the Redisson fair lock associated with a set value.
func (*RSet) GetLock ¶ added in v0.2.13
GetLock returns the Redisson lock associated with a set value.
func (*RSet) GetPermitExpirableSemaphore ¶ added in v0.2.13
func (s *RSet) GetPermitExpirableSemaphore(value any) *RPermitExpirableSemaphore
GetPermitExpirableSemaphore returns the Redisson expirable semaphore for a set value.
func (*RSet) GetReadWriteLock ¶ added in v0.2.13
func (s *RSet) GetReadWriteLock(value any) *RReadWriteLock
GetReadWriteLock returns the Redisson read-write lock for a set value.
func (*RSet) GetSemaphore ¶ added in v0.2.13
func (s *RSet) GetSemaphore(value any) *RSemaphore
GetSemaphore returns the Redisson semaphore associated with a set value.
func (*RSet) Intersection ¶ added in v0.2.13
Intersection returns members present in this set and every named set.
func (*RSet) IntersectionStore ¶ added in v0.2.13
func (s *RSet) IntersectionStore(ctx context.Context, dest string, otherNames ...string) (int64, error)
IntersectionStore stores the intersection in dest and returns its cardinality.
func (*RSet) Move ¶ added in v0.2.13
Move moves member from this set to destination (another RSet name). Returns true when the member was moved.
func (*RSet) Random ¶ added in v0.2.13
Random returns one random member, or (nil, nil) when the set is empty.
func (*RSet) RandomN ¶ added in v0.2.13
RandomN returns up to n random members (may contain duplicates when n exceeds cardinality — Redis SRANDMEMBER semantics).
func (*RSet) RemoveCounted ¶ added in v0.2.13
RemoveCounted removes members and returns how many were actually removed (Redisson removeAllCounted / SREM).
func (*RSet) RemoveRandom ¶ added in v0.2.13
RemoveRandom pops and returns one random member, or (nil, nil) when empty.
func (*RSet) RemoveRandomN ¶ added in v0.2.13
RemoveRandomN pops up to n random members.
func (*RSet) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RSet) TryAdd ¶ added in v0.2.13
TryAdd atomically adds all members only when none is already present.
func (*RSet) UnionStore ¶ added in v0.2.13
UnionStore stores the union in dest and returns its cardinality.
type RSetCache ¶
type RSetCache struct {
// contains filtered or unexported fields
}
RSetCache is an RSet with per-element TTL and maxIdle, wire-compatible with Redisson's RedissonSetCache:
ZSET {name} member = codec value,
score = absolute expiry epoch ms
(math.MaxInt64 for no TTL)
ZSET redisson__idle__set:{name} idle *duration* per member;
contains() refreshes the deadline.
func (*RSetCache) Add ¶
Add adds element with optional ttl and maxIdle (0 = disabled). Returns true when the element was not present before.
func (*RSetCache) AddIfAbsent ¶ added in v0.2.13
AddIfAbsent adds element only when it has no live TTL deadline.
func (*RSetCache) AddIfExists ¶ added in v0.2.13
AddIfExists updates the TTL only when element is live.
func (*RSetCache) AddIfGreater ¶ added in v0.2.13
AddIfGreater extends the TTL deadline of a live element.
func (*RSetCache) AddIfLess ¶ added in v0.2.13
AddIfLess shortens the TTL deadline of a live element.
func (*RSetCache) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RSetCache) ContainsAll ¶ added in v0.2.13
ContainsAll reports whether every element is live in the cache.
func (*RSetCache) Name ¶
func (o *RSetCache) Name() string
Name returns the Redis key name of the object.
func (*RSetCache) Random ¶ added in v0.2.13
Random returns one random live element, or (nil, nil) when empty.
func (*RSetCache) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RSetCache) RemoveAll ¶ added in v0.2.13
RemoveAll removes the supplied elements and reports whether the cache changed.
func (*RSetCache) RemoveRandom ¶ added in v0.2.13
RemoveRandom removes and returns one random live element.
func (*RSetCache) RemoveRandomN ¶ added in v0.2.13
RemoveRandomN removes and returns up to n distinct random live elements.
func (*RSetCache) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RSetCache) RetainAll ¶ added in v0.2.13
RetainAll keeps only the supplied live elements and reports whether changed.
type RSetMultimap ¶
type RSetMultimap struct{ RMultimap }
RSetMultimap stores an unordered value set per key.
func (*RSetMultimap) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RSetMultimap) Name ¶
func (o *RSetMultimap) Name() string
Name returns the Redis key name of the object.
func (*RSetMultimap) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RSetMultimap) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
type RSetMultimapCache ¶ added in v0.2.13
type RSetMultimapCache struct {
// contains filtered or unexported fields
}
RSetMultimapCache stores an unordered value set per key with Redisson's per-key expiration metadata.
func (RSetMultimapCache) Clear ¶ added in v0.2.13
Clear removes the index, timeout metadata and every per-key collection.
func (RSetMultimapCache) ContainsEntry ¶ added in v0.2.13
ContainsEntry reports whether the current key contains value.
func (RSetMultimapCache) ContainsKey ¶ added in v0.2.13
ContainsKey reports whether key currently has values.
func (RSetMultimapCache) ContainsValue ¶ added in v0.2.13
ContainsValue reports whether any live key is associated with value.
func (RSetMultimapCache) Entries ¶ added in v0.2.13
func (m RSetMultimapCache) Entries(ctx context.Context) ([]MultimapEntry, error)
Entries returns every live key/value association.
func (RSetMultimapCache) Expire ¶ added in v0.2.13
Expire applies ttl to the index, timeout metadata and every per-key collection, matching RedissonMultimapCache's whole-object expiration.
func (RSetMultimapCache) ExpireKey ¶ added in v0.2.13
func (m RSetMultimapCache) ExpireKey( ctx context.Context, key any, ttl time.Duration, ) (bool, error)
ExpireKey sets the lifetime of every value associated with key.
func (RSetMultimapCache) Get ¶ added in v0.2.13
Get returns the current values. Expired keys are hidden and lazily removed from the HASH, timeout ZSET and per-key collection.
func (RSetMultimapCache) GetFairLock ¶ added in v0.2.13
GetFairLock returns the Redisson fair lock for a multimap-cache key.
func (RSetMultimapCache) GetLock ¶ added in v0.2.13
GetLock returns the Redisson lock associated with a multimap-cache key.
func (RSetMultimapCache) GetReadWriteLock ¶ added in v0.2.13
func (m RSetMultimapCache) GetReadWriteLock(key any) *RReadWriteLock
GetReadWriteLock returns the Redisson read-write lock for a cache key.
func (RSetMultimapCache) GetSemaphore ¶ added in v0.2.13
func (m RSetMultimapCache) GetSemaphore(key any) *RSemaphore
GetSemaphore returns the Redisson semaphore for a multimap-cache key.
func (RSetMultimapCache) IsEmpty ¶ added in v0.2.13
IsEmpty reports whether the cache has no live associations.
func (RSetMultimapCache) Put ¶ added in v0.2.13
Put associates value with key. For an expired key it first removes the old collection, so a new association starts a fresh non-expiring key.
func (RSetMultimapCache) ReadAllKeySet ¶ added in v0.2.13
ReadAllKeySet is the eager Redisson-style alias of KeySet.
func (RSetMultimapCache) RemoveAll ¶ added in v0.2.13
RemoveAll removes key, its values and expiration metadata.
func (RSetMultimapCache) ReplaceValues ¶ added in v0.2.13
func (m RSetMultimapCache) ReplaceValues( ctx context.Context, key any, values ...any, ) ([]any, error)
ReplaceValues replaces all live values associated with key and returns the previous values. The key keeps its existing per-key expiration.
func (RSetMultimapCache) Size ¶ added in v0.2.13
Size returns the number of live key/value associations.
func (RSetMultimapCache) StartAutoEviction ¶ added in v0.2.13
StartAutoEviction periodically runs lazy expiry cleanup until the client closes (optional; default access paths already clean lazily).
type RSetMultimapCacheNative ¶ added in v0.2.13
type RSetMultimapCacheNative struct{ *RSetMultimap }
RSetMultimapCacheNative / RListMultimapCacheNative add per-key TTL via Redis HPEXPIRE on the index HASH field plus PEXPIRE on the values collection (RedissonMultimapCacheNative 4.6.1). Requires Redis ≥ 7.4.
func (RSetMultimapCacheNative) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (RSetMultimapCacheNative) Name ¶ added in v0.2.13
func (o RSetMultimapCacheNative) Name() string
Name returns the Redis key name of the object.
func (RSetMultimapCacheNative) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (RSetMultimapCacheNative) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
type RShardedTopic ¶ added in v0.2.12
type RShardedTopic struct {
// contains filtered or unexported fields
}
RShardedTopic is a cluster-friendly topic using Redis 7+ sharded pub/sub (SSUBSCRIBE / SSPUBLISH): messages stay on the slot's shard instead of broadcasting cluster-wide, so heavy topics do not saturate the bus. Messages are codec-encoded like RTopic; cross-language interop is automatic (Redis-native protocol).
func (*RShardedTopic) ClearExpire ¶ added in v0.2.12
ClearExpire removes the TTL (key becomes persistent).
func (*RShardedTopic) CountSubscribers ¶ added in v0.2.12
func (t *RShardedTopic) CountSubscribers(ctx context.Context) (int64, error)
CountSubscribers returns the sharded subscriber count (PUBSUB SHARDNUMSUB).
func (*RShardedTopic) Name ¶ added in v0.2.12
func (o *RShardedTopic) Name() string
Name returns the Redis key name of the object.
func (*RShardedTopic) Publish ¶ added in v0.2.12
Publish broadcasts via SSPUBLISH. Returns receivers count.
func (*RShardedTopic) RemainTTL ¶ added in v0.2.12
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RShardedTopic) Rename ¶ added in v0.2.12
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RShardedTopic) Subscribe ¶ added in v0.2.12
func (t *RShardedTopic) Subscribe(listener func(msg any)) (int, error)
Subscribe registers a listener and (lazily) starts the SSUBSCRIBE goroutine; blocks until the subscription is live.
func (*RShardedTopic) Unlink ¶ added in v0.2.12
Unlink removes the key asynchronously (non-blocking Redis UNLINK).
func (*RShardedTopic) Unsubscribe ¶ added in v0.2.12
func (t *RShardedTopic) Unsubscribe(id int) bool
Unsubscribe removes a listener, stopping the goroutine when empty.
type RSpinLock ¶ added in v0.2.13
type RSpinLock struct {
*RLock
}
RSpinLock is a re-entrant lock that busy-waits with short sleeps instead of pub/sub wakeups (Redisson SpinLock). Wire layout matches RLock (HASH + redisson_lock__channel:{name} unused for acquire).
func (RSpinLock) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (*RSpinLock) Lock ¶ added in v0.2.13
Lock spins until acquired or ctx cancelled. ttl semantics match RLock.
func (RSpinLock) Name ¶ added in v0.2.13
func (o RSpinLock) Name() string
Name returns the Redis key name of the object.
func (RSpinLock) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (RSpinLock) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
type RStream ¶ added in v0.2.3
type RStream struct {
// contains filtered or unexported fields
}
RStream is a distributed log backed by a Redis Stream. Field names and values are codec-encoded (matching Redisson's RStream with JsonJacksonCodec — verified via redi.py's bidirectional tests); consumer groups are Redis-native so cross-language interop is automatic.
func (*RStream) AddWithMaxLen ¶ added in v0.2.3
func (s *RStream) AddWithMaxLen(ctx context.Context, fields map[string]any, maxLen int64, approximate bool) (string, error)
AddWithMaxLen appends with optional trimming (maxLen > 0).
func (*RStream) AutoClaim ¶ added in v0.2.3
func (s *RStream) AutoClaim(ctx context.Context, group, consumer string, minIdle time.Duration, start string, count int64) ([]StreamEntry, string, error)
AutoClaim claims up to count entries idle for at least minIdle, starting the scan at start ("0-0"). Returns the entries and the next cursor.
func (*RStream) Claim ¶ added in v0.2.3
func (s *RStream) Claim(ctx context.Context, group, consumer string, minIdle time.Duration, ids ...string) ([]StreamEntry, error)
Claim atomically transfers ownership of ids to consumer (minIdle filters).
func (*RStream) ClearExpire ¶ added in v0.2.3
ClearExpire removes the TTL (key becomes persistent).
func (*RStream) CreateConsumer ¶ added in v0.2.3
CreateConsumer registers a consumer in a group.
func (*RStream) CreateGroup ¶ added in v0.2.3
CreateGroup creates a consumer group starting at id ("$" = only new entries, "0" = whole history). Returns false when the group exists.
func (*RStream) DeleteGroup ¶ added in v0.2.3
DeleteGroup removes a consumer group.
func (*RStream) FastAutoClaim ¶ added in v0.2.13
func (s *RStream) FastAutoClaim( ctx context.Context, group, consumer string, minIdle time.Duration, start string, count int64, ) ([]string, string, error)
FastAutoClaim claims entries like AutoClaim and returns only message ids.
func (*RStream) FastClaim ¶ added in v0.2.13
func (s *RStream) FastClaim( ctx context.Context, group, consumer string, minIdle time.Duration, ids ...string, ) ([]string, error)
FastClaim transfers ownership like Claim and returns only message ids.
func (*RStream) ListConsumers ¶ added in v0.2.13
ListConsumers returns consumer metadata for a group.
func (*RStream) ListGroups ¶ added in v0.2.13
ListGroups returns the stream's consumer-group metadata.
func (*RStream) Nack ¶ added in v0.2.13
func (s *RStream) Nack( ctx context.Context, group string, mode StreamNackMode, ids ...string, ) (int64, error)
Nack negatively acknowledges pending entries using Redis 8.2 XNACK.
func (*RStream) Name ¶ added in v0.2.3
func (o *RStream) Name() string
Name returns the Redis key name of the object.
func (*RStream) PendingInfo ¶ added in v0.2.13
PendingInfo returns the pending-entry summary for a group.
func (*RStream) PendingRange ¶ added in v0.2.3
func (s *RStream) PendingRange(ctx context.Context, group, consumer string, count int64) ([]PendingEntry, error)
PendingRange lists unacknowledged entries (optionally for one consumer).
func (*RStream) Read ¶ added in v0.2.13
func (s *RStream) Read(ctx context.Context, id string, count int64, block time.Duration) ([]StreamEntry, error)
Read returns entries newer than id using XREAD. block > 0 waits up to that duration; block <= 0 returns immediately.
func (*RStream) ReadGroup ¶ added in v0.2.3
func (s *RStream) ReadGroup(ctx context.Context, group, consumer string, count int64, block time.Duration) ([]StreamEntry, error)
ReadGroup delivers undelivered (">") entries to a group consumer. block > 0 waits up to that duration; block <= 0 returns immediately (go-redis emits BLOCK for any Block >= 0, and "block 0" means block forever — hence the -1 sentinels).
func (*RStream) ReadRange ¶ added in v0.2.3
func (s *RStream) ReadRange(ctx context.Context, start, end string, count int64) ([]StreamEntry, error)
ReadRange returns entries with id in [start, end] ("-" .. "+"), ascending, up to count (0 = unlimited).
func (*RStream) ReadReverse ¶ added in v0.2.3
func (s *RStream) ReadReverse(ctx context.Context, end, start string, count int64) ([]StreamEntry, error)
ReadReverse returns entries in descending id order.
func (*RStream) RemainTTL ¶ added in v0.2.3
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RStream) RemoveConsumer ¶ added in v0.2.3
RemoveConsumer removes a consumer and its pending entries.
func (*RStream) Rename ¶ added in v0.2.3
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RStream) Trim ¶ added in v0.2.3
Trim removes old entries keeping at most maxLen (XTRIM MAXLEN).
func (*RStream) TrimMinID ¶ added in v0.2.3
TrimMinID removes entries with ids older than minID (XTRIM MINID).
type RTDigest ¶ added in v0.2.13
type RTDigest struct {
// contains filtered or unexported fields
}
RTDigest wraps Redis TDIGEST.* commands (numeric sketches; no codec wrap).
func (*RTDigest) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (*RTDigest) Name ¶ added in v0.2.13
func (o *RTDigest) Name() string
Name returns the Redis key name of the object.
func (*RTDigest) Quantile ¶ added in v0.2.13
Quantile estimates values at the given quantiles (0..1).
func (*RTDigest) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RTDigest) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RTDigest) TryCreateWithCompression ¶ added in v0.2.13
TryCreateWithCompression initializes with compression.
type RTimeSeries ¶ added in v0.2.11
type RTimeSeries struct {
// contains filtered or unexported fields
}
RTimeSeries is a time-series store, wire-compatible with Redisson's RedissonTimeSeries (source-verified):
ZSET {name} entries: score = timestamp ms,
member = struct.pack('BBc0Lc0Lc0',
4, idLen, id, valLen, encoded,
lblLen, label)
ZSET redisson__ts_ttl:{name} expiry deadlines (score = epoch ms)
STRING redisson__ts_seq:{name} entry-id counter (zero-padded to
20 digits, compared as strings)
The label blob = byte(n) + label where n=2 means "no label" and n=3 means "with label" (Java's convention).
func (*RTimeSeries) Add ¶ added in v0.2.11
func (s *RTimeSeries) Add(ctx context.Context, timestampMs int64, value any, label string, ttl time.Duration) error
Add stores value at timestamp (ms). ttl <= 0 means the Java default (effectively 100 years). label == "" stores an unlabeled entry.
func (*RTimeSeries) AddAll ¶ added in v0.2.13
func (s *RTimeSeries) AddAll( ctx context.Context, entries ...TimeSeriesEntry, ) error
AddAll stores entries in one atomic script using the default Redisson TTL.
func (*RTimeSeries) ClearExpire ¶ added in v0.2.11
ClearExpire removes the TTL (key becomes persistent).
func (*RTimeSeries) Delete ¶ added in v0.2.11
func (s *RTimeSeries) Delete(ctx context.Context) error
Delete removes the series and its companion keys.
func (*RTimeSeries) FirstEntries ¶ added in v0.2.13
func (s *RTimeSeries) FirstEntries(ctx context.Context, count int) ([]TimeSeriesEntry, error)
FirstEntries returns up to count earliest unexpired entries in ascending order.
func (*RTimeSeries) FirstEntry ¶ added in v0.2.13
func (s *RTimeSeries) FirstEntry(ctx context.Context) (*TimeSeriesEntry, error)
FirstEntry returns the earliest unexpired entry, or nil when empty.
func (*RTimeSeries) FirstTimestamp ¶ added in v0.2.13
func (s *RTimeSeries) FirstTimestamp(ctx context.Context) (int64, error)
FirstTimestamp returns the earliest unexpired timestamp, or zero when empty.
func (*RTimeSeries) Get ¶ added in v0.2.11
func (s *RTimeSeries) Get(ctx context.Context, timestampMs int64) (*TimeSeriesEntry, error)
Get returns the (unexpired) entry stored at exactly timestampMs (nil when absent).
func (*RTimeSeries) GetAndRemove ¶ added in v0.2.13
GetAndRemove removes and returns the first live value at timestampMs.
func (*RTimeSeries) GetAndRemoveEntry ¶ added in v0.2.13
func (s *RTimeSeries) GetAndRemoveEntry( ctx context.Context, timestampMs int64, ) (*TimeSeriesEntry, error)
GetAndRemoveEntry removes and returns the first live entry at timestampMs.
func (*RTimeSeries) LastEntries ¶ added in v0.2.13
func (s *RTimeSeries) LastEntries(ctx context.Context, count int) ([]TimeSeriesEntry, error)
LastEntries returns up to count latest unexpired entries in ascending order.
func (*RTimeSeries) LastEntry ¶ added in v0.2.13
func (s *RTimeSeries) LastEntry(ctx context.Context) (*TimeSeriesEntry, error)
LastEntry returns the latest unexpired entry, or nil when empty.
func (*RTimeSeries) LastTimestamp ¶ added in v0.2.13
func (s *RTimeSeries) LastTimestamp(ctx context.Context) (int64, error)
LastTimestamp returns the latest unexpired timestamp, or zero when empty.
func (*RTimeSeries) Name ¶ added in v0.2.11
func (o *RTimeSeries) Name() string
Name returns the Redis key name of the object.
func (*RTimeSeries) PollFirstEntries ¶ added in v0.2.13
func (s *RTimeSeries) PollFirstEntries(ctx context.Context, count int) ([]TimeSeriesEntry, error)
PollFirstEntries removes and returns up to count earliest unexpired entries.
func (*RTimeSeries) PollLastEntries ¶ added in v0.2.13
func (s *RTimeSeries) PollLastEntries(ctx context.Context, count int) ([]TimeSeriesEntry, error)
PollLastEntries removes and returns up to count latest unexpired entries in ascending order.
func (*RTimeSeries) Range ¶ added in v0.2.11
func (s *RTimeSeries) Range(ctx context.Context, fromMs, toMs int64, limit int64) ([]TimeSeriesEntry, error)
Range returns unexpired entries in [fromMs, toMs] ascending (limit <= 0 means unlimited).
func (*RTimeSeries) RangeReversed ¶ added in v0.2.13
func (s *RTimeSeries) RangeReversed( ctx context.Context, fromMs, toMs int64, limit int64, ) ([]TimeSeriesEntry, error)
RangeReversed returns unexpired entries in [fromMs, toMs] descending. limit <= 0 means unlimited.
func (*RTimeSeries) RemainTTL ¶ added in v0.2.11
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RTimeSeries) Remove ¶ added in v0.2.11
Remove deletes the entries stored at exactly timestampMs.
func (*RTimeSeries) RemoveRange ¶ added in v0.2.13
RemoveRange removes live entries with timestamps in the inclusive range.
func (*RTimeSeries) Rename ¶ added in v0.2.11
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RTimeSeries) Size ¶ added in v0.2.11
func (s *RTimeSeries) Size(ctx context.Context) (int64, error)
Size returns the number of unexpired entries (Java's lazy semantics: ZCARD minus expired, without deleting them).
type RTopK ¶ added in v0.2.13
type RTopK struct {
// contains filtered or unexported fields
}
RTopK wraps Redis TOPK.* commands.
func (*RTopK) Add ¶ added in v0.2.13
Add increments items; returns items dropped from the top-k (possibly empty strings).
func (*RTopK) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (*RTopK) ListWithCount ¶ added in v0.2.13
ListWithCount returns item -> count.
func (*RTopK) Name ¶ added in v0.2.13
func (o *RTopK) Name() string
Name returns the Redis key name of the object.
func (*RTopK) Query ¶ added in v0.2.13
Query reports whether each element is currently in the top-k.
func (*RTopK) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RTopK) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
type RTopic ¶
type RTopic struct {
// contains filtered or unexported fields
}
RTopic is a pub/sub topic whose messages are codec (JSON) encoded, interoperable with Redisson's RTopic. Listeners run on a dedicated subscription goroutine; Publish never fans out locally (exactly-once delivery per listener).
func (*RTopic) ChannelNames ¶ added in v0.2.13
ChannelNames returns the Redis channels used by this topic.
func (*RTopic) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (*RTopic) CountListeners ¶ added in v0.2.13
CountListeners returns the number of local listeners.
func (*RTopic) CountSubscribers ¶
CountSubscribers returns the number of remote subscribers (PUBSUB NUMSUB).
func (*RTopic) GetChannelNames ¶ added in v0.2.13
GetChannelNames is the Redisson-style alias of ChannelNames.
func (*RTopic) Publish ¶
Publish broadcasts message to all subscribers (local and remote). Returns the number of clients that received it.
func (*RTopic) RemoveAllListeners ¶ added in v0.2.13
func (t *RTopic) RemoveAllListeners()
RemoveAllListeners unregisters every local listener.
func (*RTopic) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RTopic) Subscribe ¶
Subscribe registers a listener and (lazily) starts the subscription goroutine. It blocks until the subscription is confirmed by Redis.
func (*RTopic) Unsubscribe ¶
Unsubscribe removes a listener, stopping the subscription goroutine when the last one goes away.
type RTransferQueue ¶
type RTransferQueue struct {
*RQueue
}
RTransferQueue atomically moves elements from its head to the tail of a destination queue (single Lua round-trip, no TOCTOU window).
Compatibility note: this is NOT Redisson's RTransferQueue (which is built on RRemoteService handoff). It is a local Redis queue-to-queue migrate helper. Do not expect Java getTransferQueue() to share protocol with it.
func (RTransferQueue) ClearExpire ¶
ClearExpire removes the TTL (key becomes persistent).
func (RTransferQueue) Name ¶
func (o RTransferQueue) Name() string
Name returns the Redis key name of the object.
func (RTransferQueue) RemainTTL ¶
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (RTransferQueue) Rename ¶
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RTransferQueue) Transfer ¶
Transfer pops the head of this queue and pushes it onto the destination queue's tail, returning the transferred value (nil when this queue is empty).
func (*RTransferQueue) TryTransfer ¶
func (q *RTransferQueue) TryTransfer(ctx context.Context, destination string, timeout time.Duration) (any, error)
TryTransfer transfers with a blocking wait for up to timeout, polling every 50ms. Returns the transferred value (nil on timeout).
type RVectorSet ¶ added in v0.2.13
type RVectorSet struct {
// contains filtered or unexported fields
}
RVectorSet wraps Redis 8+ Vector Set commands (VADD/VSIM/…).
func (*RVectorSet) ClearExpire ¶ added in v0.2.13
ClearExpire removes the TTL (key becomes persistent).
func (*RVectorSet) Dimensions ¶ added in v0.2.13
func (v *RVectorSet) Dimensions(ctx context.Context) (int64, error)
Dimensions returns VDIM.
func (*RVectorSet) GetVector ¶ added in v0.2.13
GetVector returns approximate coordinates for element.
func (*RVectorSet) Name ¶ added in v0.2.13
func (o *RVectorSet) Name() string
Name returns the Redis key name of the object.
func (*RVectorSet) RemainTTL ¶ added in v0.2.13
RemainTTL returns the remaining time-to-live (-1 no expiry, -2 missing).
func (*RVectorSet) Rename ¶ added in v0.2.13
Rename renames the object's key. Note: for structures with companion keys (locks, delayed queues, map caches) the companion keys are not moved.
func (*RVectorSet) SimilarByElement ¶ added in v0.2.13
func (v *RVectorSet) SimilarByElement(ctx context.Context, element string, count int) ([]string, error)
SimilarByElement returns nearest neighbour names for element.
func (*RVectorSet) SimilarByVector ¶ added in v0.2.13
func (v *RVectorSet) SimilarByVector(ctx context.Context, vector []float64, count int) ([]string, error)
SimilarByVector returns nearest neighbours for a query vector.
func (*RVectorSet) Size ¶ added in v0.2.13
func (v *RVectorSet) Size(ctx context.Context) (int64, error)
Size returns VCARD.
type RateLimiterConfig ¶ added in v0.2.13
type RateLimiterConfig struct {
RateType RateType
Rate int64
Interval time.Duration
KeepAlive time.Duration
}
RateLimiterConfig is the persisted limiter configuration (Redisson RateLimiterConfig).
type ScriptReturnType ¶
type ScriptReturnType int
ScriptReturnType selects the cast applied to a Lua script reply, mirroring Redisson's RScript.ReturnType.
const ( ScriptReturnValue ScriptReturnType = iota ScriptReturnBoolean ScriptReturnInteger ScriptReturnStatus )
type SearchDocument ¶ added in v0.2.13
SearchDocument is one hit.
type SearchOptions ¶ added in v0.2.13
type SearchOptions struct {
LimitOffset int
LimitCount int
Return []string
WithScores bool
NoContent bool
}
SearchOptions configures FT.SEARCH.
type SearchResult ¶ added in v0.2.13
type SearchResult struct {
Total int64
Documents []SearchDocument
}
SearchResult is FT.SEARCH output.
type StreamEntry ¶ added in v0.2.3
StreamEntry is one stream record with codec-decoded fields.
type StreamNackMode ¶ added in v0.2.13
type StreamNackMode string
StreamNackMode controls how Redis XNACK marks delivery attempts.
const ( StreamNackSilent StreamNackMode = "SILENT" StreamNackFail StreamNackMode = "FAIL" StreamNackFatal StreamNackMode = "FATAL" )
Source Files
¶
- client.go
- codec.go
- decodeinto.go
- rarray.go
- ratomicdouble.go
- ratomiclong.go
- rbatch.go
- rbinarystream.go
- rbitset.go
- rbloomfilter.go
- rboundedblockingqueue.go
- rbucket.go
- rbuckets.go
- rcircularbuffer.go
- rclientsidecaching.go
- rcountdownlatch.go
- rdelayedqueue.go
- rdeque.go
- rfairlock.go
- rfencedlock.go
- rfunction.go
- rgeo.go
- rhyperloglog.go
- ridgenerator.go
- rjsonbucket.go
- rkey_synchronizers.go
- rkeys.go
- rlexsortedset.go
- rlist.go
- rlocalcachedmap.go
- rlock.go
- rlongadder.go
- rmap.go
- rmapcache.go
- rmapcachenative.go
- rmaps.go
- rmultilock.go
- rmultimap.go
- rmultimapcache.go
- rmultimapcachenative.go
- rnonreentrantfairlock.go
- rnonreentrantlock.go
- robject.go
- rpermitexpirablesemaphore.go
- rpriorityblocking.go
- rpriorityqueue.go
- rprobabilistic.go
- rqueue.go
- rratelimiter.go
- rreadwritelock.go
- rredisnodes.go
- rredlock.go
- rreliabletopic.go
- rringbuffer.go
- rscoredsortedset.go
- rscript.go
- rsearch.go
- rsemaphore.go
- rset.go
- rsetcache.go
- rshardedtopic.go
- rspinlock.go
- rstream.go
- rtimeseries.go
- rtopic.go
- rtransferqueue.go
- rvectorset.go