Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryCache ¶
InMemoryCache - Simple cache structure that is used for in-memory rate limiting.
func NewInMemoryCache ¶
func NewInMemoryCache(defaultExpiry time.Duration) InMemoryCache
NewInMemoryCache - Creates a new in-memory cache to be consumed by rate-limiter.
func (*InMemoryCache) Get ¶
func (c *InMemoryCache) Get(key string) string
Get - Retrieves object for key pair from go-cache.
type RateCache ¶
type RateCache interface { Set(key string, object string, duration time.Duration) Get(key string) string }
RateCache - abstracts the cache backend. Any cache struct that implements this interface can be used for rate limiting.
type RedisCache ¶
RedisCache - Simple cache structure that is uses redis rate limiting.
func NewRedisCache ¶
func NewRedisCache(defaultExpiry time.Duration, client *redis.Client) RedisCache
NewRedisCache - Creates a new redis cache to be consumed by rate-limiter.
func (*RedisCache) Get ¶
func (c *RedisCache) Get(key string) string
Get - Retrieves object for key pair from redis.
Click to show internal directories.
Click to hide internal directories.