Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStore ¶
NewStore creates a new instance of memory store with defaults.
func NewStoreWithOptions ¶
func NewStoreWithOptions(options limiter.StoreOptions) limiter.Store
NewStoreWithOptions creates a new instance of memory store with options.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache contains a collection of counters.
func (*Cache) Get ¶
Get returns key's value and expiration.
type CacheWrapper ¶
type CacheWrapper struct {
*Cache
}
CacheWrapper is used to ensure that the underlying cleaner goroutine used to clean expired keys will not prevent Cache from being garbage collected.
func NewCache ¶
func NewCache(cleanInterval time.Duration) *CacheWrapper
NewCache returns a new cache.
type Counter ¶
Counter is a simple counter with an optional expiration.
type Store ¶
type Store struct {
// Prefix used for the key.
Prefix string
// contains filtered or unexported fields
}
Store is the in-memory store.
Source Files
¶
- cache.go
- store.go
Click to show internal directories.
Click to hide internal directories.