Documentation
¶
Index ¶
- func HealthCheck(ctx context.Context, client *redis.Client) error
- func NewRedisClient(addr, password string, db int) *redis.Client
- type RateLimiter
- func (rl *RateLimiter) GetCurrentCount(ctx context.Context, userID string) (int, error)
- func (rl *RateLimiter) GetRemainingCount(ctx context.Context, userID string) (int, error)
- func (rl *RateLimiter) GetTTL(ctx context.Context, userID string) (time.Duration, error)
- func (rl *RateLimiter) IsAllowed(ctx context.Context, userID string) (bool, error)
- func (rl *RateLimiter) Reset(ctx context.Context, userID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HealthCheck ¶
HealthCheck performs a health check on the Redis connection
func NewRedisClient ¶
NewRedisClient creates a new Redis client with the given configuration
Types ¶
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter provides Redis-based rate limiting functionality
func NewRateLimiter ¶
func NewRateLimiter(client *redis.Client, limit int, window time.Duration) *RateLimiter
NewRateLimiter creates a new Redis-based rate limiter
func (*RateLimiter) GetCurrentCount ¶
GetCurrentCount returns the current count for a user
func (*RateLimiter) GetRemainingCount ¶
GetRemainingCount returns remaining notifications allowed for a user
Click to show internal directories.
Click to hide internal directories.