Documentation ¶
Index ¶
- Variables
- type Cache
- type Entry
- type Item
- func (i Item) Bool() (bool, error)
- func (i Item) EntryNotFound() bool
- func (i Item) Error() error
- func (i Item) Float32() (float32, error)
- func (i Item) Float64() (float64, error)
- func (i Item) Int() (int, error)
- func (i Item) Int64() (int64, error)
- func (i Item) Key() string
- func (i Item) String() (string, error)
- func (i Item) TagKey() string
- func (i Item) Uint64() (uint64, error)
- func (i Item) Unmarshal(entity interface{}) error
- type Items
- type LocalConfig
- type LocalStore
- func (s *LocalStore) Add(key string, value interface{}, duration time.Duration) (bool, error)
- func (*LocalStore) Close() error
- func (s *LocalStore) Decrement(key string, value int64) (int64, error)
- func (s *LocalStore) Exists(key string) (bool, error)
- func (s *LocalStore) Expire(string, time.Duration) error
- func (s *LocalStore) Flush() (bool, error)
- func (s *LocalStore) Forever(key string, value interface{}) error
- func (s *LocalStore) Forget(key string) (bool, error)
- func (s *LocalStore) ForgetMany(keys ...string) error
- func (s *LocalStore) Get(key string, entity interface{}) error
- func (s *LocalStore) GetBool(key string) (bool, error)
- func (s *LocalStore) GetFloat32(key string) (float32, error)
- func (s *LocalStore) GetFloat64(key string) (float64, error)
- func (s *LocalStore) GetInt(key string) (int, error)
- func (s *LocalStore) GetInt64(key string) (int64, error)
- func (s *LocalStore) GetString(key string) (string, error)
- func (s *LocalStore) GetUint64(key string) (uint64, error)
- func (s *LocalStore) Increment(key string, value int64) (int64, error)
- func (s *LocalStore) Lock(name, owner string, duration time.Duration) Lock
- func (s *LocalStore) Many(keys ...string) (Items, error)
- func (c *LocalStore) Prefix() string
- func (s *LocalStore) Put(key string, value interface{}, duration time.Duration) error
- func (s *LocalStore) PutMany(entries ...Entry) error
- func (s *LocalStore) Tags(names ...string) TaggedCache
- type Lock
- type MemcacheConfig
- type MemcacheStore
- func (s *MemcacheStore) Add(key string, value interface{}, duration time.Duration) (bool, error)
- func (*MemcacheStore) Close() error
- func (s *MemcacheStore) Decrement(key string, value int64) (int64, error)
- func (s *MemcacheStore) Exists(key string) (bool, error)
- func (s *MemcacheStore) Expire(key string, duration time.Duration) error
- func (s *MemcacheStore) Flush() (bool, error)
- func (s *MemcacheStore) Forever(key string, value interface{}) error
- func (s *MemcacheStore) Forget(key string) (bool, error)
- func (s *MemcacheStore) ForgetMany(keys ...string) error
- func (s *MemcacheStore) Get(key string, entity interface{}) error
- func (s *MemcacheStore) GetBool(key string) (bool, error)
- func (s *MemcacheStore) GetFloat32(key string) (float32, error)
- func (s *MemcacheStore) GetFloat64(key string) (float64, error)
- func (s *MemcacheStore) GetInt(key string) (int, error)
- func (s *MemcacheStore) GetInt64(key string) (int64, error)
- func (s *MemcacheStore) GetString(key string) (string, error)
- func (s *MemcacheStore) GetUint64(key string) (uint64, error)
- func (s *MemcacheStore) Increment(key string, value int64) (int64, error)
- func (s *MemcacheStore) Lock(name, owner string, duration time.Duration) Lock
- func (s *MemcacheStore) Many(keys ...string) (Items, error)
- func (c *MemcacheStore) Prefix() string
- func (s *MemcacheStore) Put(key string, value interface{}, duration time.Duration) error
- func (s *MemcacheStore) PutMany(entries ...Entry) error
- func (s *MemcacheStore) Tags(names ...string) TaggedCache
- type RateLimiter
- func (l *RateLimiter) Attempts(key string) (int64, error)
- func (l *RateLimiter) AttemptsLeft(key string, maxAttempts int64) (int64, error)
- func (l *RateLimiter) AvailableIn(key string) (time.Duration, error)
- func (l *RateLimiter) Clear(key string) error
- func (l *RateLimiter) Hit(key string, decay time.Duration) (hits int64, err error)
- func (l *RateLimiter) Throttle(key string, maxCalls int64, decay time.Duration, fn func() error) (*ThrottleResponse, error)
- func (l *RateLimiter) TooManyAttempts(key string, maxAttempts int64) (bool, error)
- type RedisConfig
- type RedisStore
- func (s *RedisStore) Add(key string, value interface{}, duration time.Duration) (bool, error)
- func (s *RedisStore) Close() error
- func (s *RedisStore) Decrement(key string, value int64) (int64, error)
- func (s *RedisStore) Exists(key string) (bool, error)
- func (s *RedisStore) Expire(key string, duration time.Duration) error
- func (s *RedisStore) Flush() (bool, error)
- func (s *RedisStore) Forever(key string, value interface{}) error
- func (s *RedisStore) Forget(key string) (bool, error)
- func (s *RedisStore) ForgetMany(keys ...string) error
- func (s *RedisStore) Get(key string, entity interface{}) error
- func (s *RedisStore) GetBool(key string) (bool, error)
- func (s *RedisStore) GetFloat32(key string) (float32, error)
- func (s *RedisStore) GetFloat64(key string) (float64, error)
- func (s *RedisStore) GetInt(key string) (int, error)
- func (s *RedisStore) GetInt64(key string) (int64, error)
- func (s *RedisStore) GetString(key string) (string, error)
- func (s *RedisStore) GetUint64(key string) (uint64, error)
- func (s *RedisStore) Increment(key string, value int64) (int64, error)
- func (s *RedisStore) Lock(name, owner string, duration time.Duration) Lock
- func (s *RedisStore) Lpush(segment, key string) error
- func (s *RedisStore) Lrange(key string, start, stop int64) []string
- func (s *RedisStore) Many(keys ...string) (Items, error)
- func (c *RedisStore) Prefix() string
- func (s *RedisStore) Put(key string, value interface{}, duration time.Duration) error
- func (s *RedisStore) PutMany(entries ...Entry) error
- func (s *RedisStore) Tags(names ...string) TaggedCache
- type TagSet
- type TaggedCache
- type ThrottleResponse
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound represents an agnostic cache entry not found error ErrNotFound = errors.New("gocache: not found") // ErrFailedToRetrieveEntry indicates that an entry was not able to be properly retrieved from the cache when // calling cache.Many ErrFailedToRetrieveEntry = errors.New("gocache: an error occurred while retrieving value, for more detail call Item.Error()") // ErrFailedToAddItemEntry is returned when we expected to add an entry to the cache but an entry was already // present for the given key ErrFailedToAddItemEntry = errors.New("gocache: failed to add entry to cache") // ErrBlockWaitTimeout is returned when the max wait for acquiring a lock during a Block call is exceeded ErrBlockWaitTimeout = errors.New("gocache: failed to acquire lock due to lock wait timeout") // ErrNotImplemented is returned for methods that have not been implemented for the Cache interface ErrNotImplemented = errors.New("gocache: method not implemented") )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { // Lock returns an implementation of the Lock interface Lock(name, owner string, duration time.Duration) Lock // contains filtered or unexported methods }
Cache represents the methods a caching store needs to implement
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
Item represents a retrieved entry from the cache
func (Item) EntryNotFound ¶
EntryNotFound checks if an entry was retrieved for the given key
type LocalConfig ¶
type LocalConfig struct { // The value to be appended to every cache entry Prefix string // DefaultInterval is the interval at which the local store will check for expired keys DefaultInterval time.Duration // DefaultExpiration is the default local store cache entry expiration time DefaultExpiration time.Duration }
LocalConfig represents the configuration for a cache with a map backend
type LocalStore ¶
type LocalStore struct {
// contains filtered or unexported fields
}
LocalStore is the representation of a map caching store
func NewLocalStore ¶
func NewLocalStore(cnf *LocalConfig, encoder encoder.Encoder) (*LocalStore, error)
NewLocalStore validates the passed in config and creates a Cache implementation of type *LocalStore
func (*LocalStore) Add ¶ added in v1.0.2
Add an item to the cache only if an item doesn't already exist for the given key, or if the existing item has expired. If the record was successfully added true will be returned else false will be returned
func (*LocalStore) Close ¶
func (*LocalStore) Close() error
Close closes the c releasing all open resources
func (*LocalStore) Decrement ¶
func (s *LocalStore) Decrement(key string, value int64) (int64, error)
Decrement decrements an integer counter by a given value
func (*LocalStore) Exists ¶ added in v1.0.1
func (s *LocalStore) Exists(key string) (bool, error)
Exists checks if an entry exists in the cache for the given key
func (*LocalStore) Expire ¶ added in v1.0.6
func (s *LocalStore) Expire(string, time.Duration) error
Expire implementation of the Cache interface
func (*LocalStore) Forever ¶
func (s *LocalStore) Forever(key string, value interface{}) error
Forever puts a value in the given store until it is forgotten/evicted
func (*LocalStore) Forget ¶
func (s *LocalStore) Forget(key string) (bool, error)
Forget forgets/evicts a given key-value pair from the store
func (*LocalStore) ForgetMany ¶ added in v1.0.3
func (s *LocalStore) ForgetMany(keys ...string) error
ForgetMany forgets/evicts a set of given key-value pair from the store
func (*LocalStore) Get ¶
func (s *LocalStore) Get(key string, entity interface{}) error
Get gets the struct representation of a value from the store
func (*LocalStore) GetBool ¶
func (s *LocalStore) GetBool(key string) (bool, error)
GetBool gets a bool value from the store
func (*LocalStore) GetFloat32 ¶
func (s *LocalStore) GetFloat32(key string) (float32, error)
GetFloat32 gets a float32 value from the store
func (*LocalStore) GetFloat64 ¶
func (s *LocalStore) GetFloat64(key string) (float64, error)
GetFloat64 gets a float value from the store
func (*LocalStore) GetInt ¶
func (s *LocalStore) GetInt(key string) (int, error)
GetInt gets an int value from the store
func (*LocalStore) GetInt64 ¶
func (s *LocalStore) GetInt64(key string) (int64, error)
GetInt64 gets an int value from the store
func (*LocalStore) GetString ¶
func (s *LocalStore) GetString(key string) (string, error)
GetString gets a string value from the store
func (*LocalStore) GetUint64 ¶
func (s *LocalStore) GetUint64(key string) (uint64, error)
GetUint64 gets an uint64 value from the store
func (*LocalStore) Increment ¶
func (s *LocalStore) Increment(key string, value int64) (int64, error)
Increment increments an integer counter by a given value
func (*LocalStore) Lock ¶
func (s *LocalStore) Lock(name, owner string, duration time.Duration) Lock
Lock returns a map implementation of the Lock interface
func (*LocalStore) Many ¶
func (s *LocalStore) Many(keys ...string) (Items, error)
Many gets many values from the store
func (*LocalStore) Put ¶
func (s *LocalStore) Put(key string, value interface{}, duration time.Duration) error
Put puts a value in the given store for a predetermined amount of time in seconds.
func (*LocalStore) PutMany ¶
func (s *LocalStore) PutMany(entries ...Entry) error
PutMany puts many values in the given store until they are forgotten/evicted
func (*LocalStore) Tags ¶
func (s *LocalStore) Tags(names ...string) TaggedCache
Tags returns the taggedCache for the given store
type Lock ¶
type Lock interface { // Get attempts to acquire a lock. If acquired, fn will be invoked and the lock will be safely release once // the invocation either succeeds or errors Get(fn func() error) (acquired bool, err error) // Block will attempt to acquire a lock for the specified "wait" time. If acquired, fn will be invoked and // the lock will be safely release once the invocation either succeeds or errors. The interval variable // will be used as the wait duration between attempts to acquire the lock Block(interval, wait time.Duration, fn func() error) (acquired bool, err error) // contains filtered or unexported methods }
Lock represents the methods to be implemented by a cache lock
type MemcacheConfig ¶
type MemcacheConfig struct { // The value to be appended to every cache entry Prefix string // Timeout specifies the socket read/write timeout. // If zero, DefaultTimeout is used. Timeout time.Duration // MaxIdleConns specifies the maximum number of idle connections that will // be maintained per address. If less than one, DefaultMaxIdleConns will be // used. // // Consider your expected traffic rates and latency carefully. This should // be set to a number higher than your peak parallel requests. MaxIdleConns int // Servers list to be used by the c. Each server is weighted the same Servers []string }
MemcacheConfig represents the configuration for a cache with a Memcache backend
type MemcacheStore ¶
type MemcacheStore struct {
// contains filtered or unexported fields
}
MemcacheStore is the representation of the memcache caching store
func NewMemcacheStore ¶
func NewMemcacheStore(cnf *MemcacheConfig, encoder encoder.Encoder) (*MemcacheStore, error)
NewMemcacheStore validates the passed in config and creates a Cache implementation of type *MemcacheStore
func (*MemcacheStore) Add ¶ added in v1.0.2
Add an item to the cache only if an item doesn't already exist for the given key, or if the existing item has expired. If the record was successfully added true will be returned else false will be returned
func (*MemcacheStore) Close ¶
func (*MemcacheStore) Close() error
Close closes the c releasing all open resources
func (*MemcacheStore) Decrement ¶
func (s *MemcacheStore) Decrement(key string, value int64) (int64, error)
Decrement decrements an integer counter by a given value. Please note that for memcache a new value will be capped at 0
func (*MemcacheStore) Exists ¶ added in v1.0.1
func (s *MemcacheStore) Exists(key string) (bool, error)
Exists checks if an entry exists in the cache for the given key
func (*MemcacheStore) Expire ¶ added in v1.0.6
func (s *MemcacheStore) Expire(key string, duration time.Duration) error
Expire implementation of the Cache interface
func (*MemcacheStore) Forever ¶
func (s *MemcacheStore) Forever(key string, value interface{}) error
Forever puts a value in the given store until it is forgotten/evicted
func (*MemcacheStore) Forget ¶
func (s *MemcacheStore) Forget(key string) (bool, error)
Forget forgets/evicts a given key-value pair from the store
func (*MemcacheStore) ForgetMany ¶ added in v1.0.3
func (s *MemcacheStore) ForgetMany(keys ...string) error
ForgetMany forgets/evicts a set of given key-value pair from the store
func (*MemcacheStore) Get ¶
func (s *MemcacheStore) Get(key string, entity interface{}) error
Get gets the struct representation of a value from the store
func (*MemcacheStore) GetBool ¶
func (s *MemcacheStore) GetBool(key string) (bool, error)
GetBool gets a bool value from the store
func (*MemcacheStore) GetFloat32 ¶
func (s *MemcacheStore) GetFloat32(key string) (float32, error)
GetFloat32 gets a float32 value from the store
func (*MemcacheStore) GetFloat64 ¶
func (s *MemcacheStore) GetFloat64(key string) (float64, error)
GetFloat64 gets a float64 value from the store
func (*MemcacheStore) GetInt ¶
func (s *MemcacheStore) GetInt(key string) (int, error)
GetInt gets an int value from the store
func (*MemcacheStore) GetInt64 ¶
func (s *MemcacheStore) GetInt64(key string) (int64, error)
GetInt64 gets an int64 value from the store
func (*MemcacheStore) GetString ¶
func (s *MemcacheStore) GetString(key string) (string, error)
GetString gets a string value from the store
func (*MemcacheStore) GetUint64 ¶
func (s *MemcacheStore) GetUint64(key string) (uint64, error)
GetUint64 gets an uint64 value from the store
func (*MemcacheStore) Increment ¶
func (s *MemcacheStore) Increment(key string, value int64) (int64, error)
Increment increments an integer counter by a given value
func (*MemcacheStore) Lock ¶
func (s *MemcacheStore) Lock(name, owner string, duration time.Duration) Lock
Lock returns a memcache implementation of the Lock interface
func (*MemcacheStore) Many ¶
func (s *MemcacheStore) Many(keys ...string) (Items, error)
Many gets many values from the store
func (*MemcacheStore) Prefix ¶
func (c *MemcacheStore) Prefix() string
Prefix gets the cache key val
func (*MemcacheStore) Put ¶
func (s *MemcacheStore) Put(key string, value interface{}, duration time.Duration) error
Put puts a value in the given store for a predetermined amount of time in seconds
func (*MemcacheStore) PutMany ¶
func (s *MemcacheStore) PutMany(entries ...Entry) error
PutMany puts many values in the given store until they are forgotten/evicted
func (*MemcacheStore) Tags ¶
func (s *MemcacheStore) Tags(names ...string) TaggedCache
Tags returns the taggedCache for the given store
type RateLimiter ¶ added in v1.0.4
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter is a struct whose purpose is to limit the rate at which something is executed or accessed. The underlying logic of this implementation allows for a max number of hits x for a given duration y. If x is exceeded during the y timeframe the RateLimiter will limit further calls until duration y expires. Once duration y is expired calls will reset back to 0
func NewRateLimiter ¶ added in v1.0.4
func NewRateLimiter(cache Cache) *RateLimiter
NewRateLimiter creates an instance of *RateLimiter
func (*RateLimiter) Attempts ¶ added in v1.0.4
func (l *RateLimiter) Attempts(key string) (int64, error)
Attempts gets the number of attempts for the given key
func (*RateLimiter) AttemptsLeft ¶ added in v1.0.4
func (l *RateLimiter) AttemptsLeft(key string, maxAttempts int64) (int64, error)
AttemptsLeft gets the number of attempts left for a given key
func (*RateLimiter) AvailableIn ¶ added in v1.0.4
func (l *RateLimiter) AvailableIn(key string) (time.Duration, error)
AvailableIn gets the number of seconds until the "key" is accessible again
func (*RateLimiter) Clear ¶ added in v1.0.4
func (l *RateLimiter) Clear(key string) error
Clear clears the hits and lockout timer for the given key
func (*RateLimiter) Hit ¶ added in v1.0.4
Hit increments the counter for a given key for a given decay time
func (*RateLimiter) Throttle ¶ added in v1.0.4
func (l *RateLimiter) Throttle(key string, maxCalls int64, decay time.Duration, fn func() error) (*ThrottleResponse, error)
Throttle rate limits the calls that made to fn
func (*RateLimiter) TooManyAttempts ¶ added in v1.0.4
func (l *RateLimiter) TooManyAttempts(key string, maxAttempts int64) (bool, error)
TooManyAttempts determines if the given key has been "accessed" too many times
type RedisConfig ¶
type RedisConfig struct { // The value to be appended to every cache entry Prefix string // The network type, either tcp or unix. // Default is tcp. Network string // host:port address. Addr string // Dialer creates new network connection and has priority over // Network and Addr options. Dialer func() (net.Conn, error) // Hook that is called when new connection is established. OnConnect func(*redis.Conn) error // Optional password. Must match the password specified in the // requirepass server configuration option. Password string // Database to be selected after connecting to the server. DB int // Maximum number of retries before giving up. // Default is to not retry failed commands. MaxRetries int // Minimum backoff between each retry. // Default is 8 milliseconds; -1 disables backoff. MinRetryBackoff time.Duration // Maximum backoff between each retry. // Default is 512 milliseconds; -1 disables backoff. MaxRetryBackoff time.Duration // Dial timeout for establishing new connections. // Default is 5 seconds. DialTimeout time.Duration // Timeout for socket reads. If reached, commands will fail // with a timeout instead of blocking. Use value -1 for no timeout and 0 for default. // Default is 3 seconds. ReadTimeout time.Duration // Timeout for socket writes. If reached, commands will fail // with a timeout instead of blocking. // Default is ReadTimeout. WriteTimeout time.Duration // Maximum number of socket connections. // Default is 10 connections per every CPU as reported by runtime.NumCPU. PoolSize int // Minimum number of idle connections which is useful when establishing // new connection is slow. MinIdleConns int // Connection age at which c retires (closes) the connection. // Default is to not close aged connections. MaxConnAge time.Duration // Amount of time c waits for connection if all connections // are busy before returning an error. // Default is ReadTimeout + 1 second. PoolTimeout time.Duration // Amount of time after which c closes idle connections. // Should be less than server's timeout. // Default is 5 minutes. -1 disables idle timeout check. IdleTimeout time.Duration // Frequency of idle checks made by idle connections reaper. // Default is 1 minute. -1 disables idle connections reaper, // but idle connections are still discarded by the c // if IdleTimeout is set. IdleCheckFrequency time.Duration // TLS Config to use. When set TLS will be negotiated. TLSConfig *tls.Config }
RedisConfig represents the configuration for a cache with a redis backend
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
RedisStore is the representation of the redis caching store
func NewRedisStore ¶
func NewRedisStore(cnf *RedisConfig, encoder encoder.Encoder) (*RedisStore, error)
NewRedisStore validates the passed in config and creates a Cache implementation of type *RedisStore
func (*RedisStore) Add ¶ added in v1.0.2
Add an item to the cache only if an item doesn't already exist for the given key, or if the existing item has expired. If the record was successfully added true will be returned else false will be returned
func (*RedisStore) Close ¶
func (s *RedisStore) Close() error
Close closes the c releasing all open resources
func (*RedisStore) Decrement ¶
func (s *RedisStore) Decrement(key string, value int64) (int64, error)
Decrement decrements an integer counter by a given value
func (*RedisStore) Exists ¶ added in v1.0.1
func (s *RedisStore) Exists(key string) (bool, error)
Exists checks if an entry exists in the cache for the given key
func (*RedisStore) Expire ¶ added in v1.0.6
func (s *RedisStore) Expire(key string, duration time.Duration) error
Expire implementation of the Cache interface
func (*RedisStore) Forever ¶
func (s *RedisStore) Forever(key string, value interface{}) error
Forever puts a value in the given store until it is forgotten/evicted
func (*RedisStore) Forget ¶
func (s *RedisStore) Forget(key string) (bool, error)
Forget forgets/evicts a given key-value pair from the store
func (*RedisStore) ForgetMany ¶ added in v1.0.3
func (s *RedisStore) ForgetMany(keys ...string) error
ForgetMany forgets/evicts a set of given key-value pair from the store
func (*RedisStore) Get ¶
func (s *RedisStore) Get(key string, entity interface{}) error
Get gets the struct representation of a value from the store
func (*RedisStore) GetBool ¶
func (s *RedisStore) GetBool(key string) (bool, error)
GetBool gets a bool value from the store
func (*RedisStore) GetFloat32 ¶
func (s *RedisStore) GetFloat32(key string) (float32, error)
GetFloat32 gets a float32 value from the store
func (*RedisStore) GetFloat64 ¶
func (s *RedisStore) GetFloat64(key string) (float64, error)
GetFloat64 gets a float64 value from the store
func (*RedisStore) GetInt ¶
func (s *RedisStore) GetInt(key string) (int, error)
GetInt gets an int value from the store
func (*RedisStore) GetInt64 ¶
func (s *RedisStore) GetInt64(key string) (int64, error)
GetInt64 gets an int64 value from the store
func (*RedisStore) GetString ¶
func (s *RedisStore) GetString(key string) (string, error)
GetString gets a string value from the store
func (*RedisStore) GetUint64 ¶
func (s *RedisStore) GetUint64(key string) (uint64, error)
GetUint64 gets an uint64 value from the store
func (*RedisStore) Increment ¶
func (s *RedisStore) Increment(key string, value int64) (int64, error)
Increment increments an integer counter by a given value
func (*RedisStore) Lock ¶
func (s *RedisStore) Lock(name, owner string, duration time.Duration) Lock
Lock returns a redis implementation of the Lock interface
func (*RedisStore) Lpush ¶
func (s *RedisStore) Lpush(segment, key string) error
Lpush runs the Redis lpush command (used via reflection, do not delete)
func (*RedisStore) Lrange ¶
func (s *RedisStore) Lrange(key string, start, stop int64) []string
Lrange runs the Redis lrange command (used via reflection, do not delete)
func (*RedisStore) Many ¶
func (s *RedisStore) Many(keys ...string) (Items, error)
Many gets many values from the store
func (*RedisStore) Put ¶
func (s *RedisStore) Put(key string, value interface{}, duration time.Duration) error
Put puts a value in the given store for a predetermined amount of time in seconds
func (*RedisStore) PutMany ¶
func (s *RedisStore) PutMany(entries ...Entry) error
PutMany puts many values in the given store until they are forgotten/evicted
func (*RedisStore) Tags ¶
func (s *RedisStore) Tags(names ...string) TaggedCache
Tags returns the taggedCache for the given store
type TagSet ¶ added in v1.0.3
type TagSet struct {
// contains filtered or unexported fields
}
TagSet is the representation of a set of tags to be used to interact with the caching stores
func (*TagSet) Flush ¶ added in v1.0.3
Flush clears removes all tags associated with the TagSet from the cache
type TaggedCache ¶
type TaggedCache interface { // TagSet returns the underlying tagged cache tag set TagSet() *TagSet // contains filtered or unexported methods }
TaggedCache represents the methods a tagged-caching store needs to implement
type ThrottleResponse ¶ added in v1.0.4
type ThrottleResponse struct {
// contains filtered or unexported fields
}
ThrottleResponse contains relevant information with respect to calls that are meant to be rate limited
func (*ThrottleResponse) IsThrottled ¶ added in v1.0.4
func (r *ThrottleResponse) IsThrottled() bool
IsThrottled returns if the number of calls have been throttled
func (*ThrottleResponse) MaxAttempts ¶ added in v1.0.4
func (r *ThrottleResponse) MaxAttempts() int64
MaxAttempts returns the max attempts for a given call
func (*ThrottleResponse) RemainingAttempts ¶ added in v1.0.4
func (r *ThrottleResponse) RemainingAttempts() int64
RemainingAttempts returns the remaining calls that can be made to a function before it is throttled
func (*ThrottleResponse) RetryAfter ¶ added in v1.0.4
func (r *ThrottleResponse) RetryAfter() time.Duration
RetryAfter returns the duration that one should wait before executing the next call