Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLocalCacheStats ¶ added in v1.4.0
Types ¶
type Connection ¶
type Connection interface { // Append a command onto the pipeline queue. // @param command supplies the command to append. // @param args supplies the additional arguments. PipeAppend(command string, args ...interface{}) // Execute the pipeline queue and wait for a response. // @return a response object. // Throws a RedisError if there was an error fetching the response. PipeResponse() Response }
Interface for a redis connection.
type JitterRandSource ¶
type JitterRandSource interface { // @return a non-negative pseudo-random 63-bit integer as an int64. Int63() int64 // @param seed initializes pseudo-random generator to a deterministic state. Seed(seed int64) }
Interface for a rand Source for expiration jitter.
func NewLockedSource ¶
func NewLockedSource(seed int64) JitterRandSource
type Pool ¶
type Pool interface { // Get a connection from the pool. Call Put() on the connection when done. // Throws RedisError if a connection can not be obtained. Get() Connection // Put a connection back into the pool. // @param c supplies the connection to put back. Put(c Connection) }
Interface for a redis connection pool.
type RateLimitCache ¶
type RateLimitCache interface { // Contact the cache and perform rate limiting for a set of descriptors and limits. // @param ctx supplies the request context. // @param request supplies the ShouldRateLimit service request. // @param limits supplies the list of associated limits. It's possible for a limit to be nil // which means that the associated descriptor does not need to be checked. This // is done for simplicity reasons in the overall service API. The length of this // list must be same as the length of the descriptors list. // @return a list of DescriptorStatuses which corresponds to each passed in descriptor/limit pair. // Throws RedisError if there was any error talking to the cache. DoLimit( ctx context.Context, request *pb.RateLimitRequest, limits []*config.RateLimit) []*pb.RateLimitResponse_DescriptorStatus }
Interface for interacting with a cache backend for rate limiting.
func NewRateLimitCacheImpl ¶
func NewRateLimitCacheImpl(pool Pool, perSecondPool Pool, timeSource TimeSource, jitterRand *rand.Rand, expirationJitterMaxSeconds int64, localCache *freecache.Cache) RateLimitCache
type RedisError ¶
type RedisError string
Errors that may be raised during config parsing.
func (RedisError) Error ¶
func (e RedisError) Error() string
type Response ¶
type Response interface { // @return the response as an integer. // Throws a RedisError if the response is not convertable to an integer. Int() int64 }
Interface for a redis response.
type TimeSource ¶
type TimeSource interface { // @return the current unix time in seconds. UnixNow() int64 }
Interface for a time source.
func NewTimeSourceImpl ¶
func NewTimeSourceImpl() TimeSource
Click to show internal directories.
Click to hide internal directories.