Documentation ¶
Index ¶
- Variables
- func PrefixedInt64Key(prefix string, key int64) string
- type ExpiringHash
- func (h *ExpiringHash) GC(ctx context.Context) (int, error)
- func (h *ExpiringHash) Refresh(ctx context.Context) error
- func (h *ExpiringHash) Scan(ctx context.Context, key interface{}, cb ScanCallback) (keysDeleted int, retErr error)
- func (h *ExpiringHash) Set(ctx context.Context, key interface{}, hashKey int64, value *anypb.Any) error
- func (h *ExpiringHash) Unset(ctx context.Context, key interface{}, hashKey int64) error
- type ExpiringHashInterface
- type ExpiringValue
- func (*ExpiringValue) Descriptor() ([]byte, []int)deprecated
- func (x *ExpiringValue) GetExpiresAt() *timestamppb.Timestamp
- func (x *ExpiringValue) GetValue() *anypb.Any
- func (*ExpiringValue) ProtoMessage()
- func (x *ExpiringValue) ProtoReflect() protoreflect.Message
- func (x *ExpiringValue) Reset()
- func (x *ExpiringValue) String() string
- type KeyToRedisKey
- type RpcApi
- type ScanCallback
- type TokenLimiter
Constants ¶
This section is empty.
Variables ¶
View Source
var File_internal_tool_redistool_redistool_proto protoreflect.FileDescriptor
Functions ¶
func PrefixedInt64Key ¶
Types ¶
type ExpiringHash ¶
type ExpiringHash struct {
// contains filtered or unexported fields
}
func NewExpiringHash ¶
func NewExpiringHash(log *zap.Logger, client redis.UniversalClient, keyToRedisKey KeyToRedisKey, ttl time.Duration) *ExpiringHash
func (*ExpiringHash) Scan ¶
func (h *ExpiringHash) Scan(ctx context.Context, key interface{}, cb ScanCallback) (keysDeleted int, retErr error)
type ExpiringHashInterface ¶
type ExpiringHashInterface interface { Set(ctx context.Context, key interface{}, hashKey int64, value *anypb.Any) error Unset(ctx context.Context, key interface{}, hashKey int64) error Scan(ctx context.Context, key interface{}, cb ScanCallback) (int, error) // GC iterates all relevant stored data and deletes expired entries. // It returns number of deleted Redis (hash) keys, including when an error occurs. // It only inspects/GCs hashes where it has entries. Other concurrent clients GC same and/or other corresponding hashes. // Hashes that don't have a corresponding client (e.g. because it crashed) will expire because of TTL on the hash key. GC(ctx context.Context) (int, error) Refresh(ctx context.Context) error }
type ExpiringValue ¶
type ExpiringValue struct { ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` Value *anypb.Any `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
func (*ExpiringValue) Descriptor
deprecated
func (*ExpiringValue) Descriptor() ([]byte, []int)
Deprecated: Use ExpiringValue.ProtoReflect.Descriptor instead.
func (*ExpiringValue) GetExpiresAt ¶
func (x *ExpiringValue) GetExpiresAt() *timestamppb.Timestamp
func (*ExpiringValue) GetValue ¶
func (x *ExpiringValue) GetValue() *anypb.Any
func (*ExpiringValue) ProtoMessage ¶
func (*ExpiringValue) ProtoMessage()
func (*ExpiringValue) ProtoReflect ¶
func (x *ExpiringValue) ProtoReflect() protoreflect.Message
func (*ExpiringValue) Reset ¶
func (x *ExpiringValue) Reset()
func (*ExpiringValue) String ¶
func (x *ExpiringValue) String() string
type KeyToRedisKey ¶
type KeyToRedisKey func(key interface{}) string
KeyToRedisKey is used to convert key1 in HSET key1 key2 value.
type TokenLimiter ¶
type TokenLimiter struct {
// contains filtered or unexported fields
}
TokenLimiter is a redis-based rate limiter implementing the algorithm in https://redislabs.com/redis-best-practices/basic-rate-limiting/
func NewTokenLimiter ¶
func NewTokenLimiter(redisClient redis.UniversalClient, keyPrefix string, limitPerMinute uint64, getApi func(context.Context) RpcApi) *TokenLimiter
NewTokenLimiter returns a new TokenLimiter
Click to show internal directories.
Click to hide internal directories.