Documentation
¶
Index ¶
- type InMemory
- func (i *InMemory) Add(key string, resource string, now time.Time) (int, error)
- func (i *InMemory) Connect() error
- func (i *InMemory) Create(key string, resource string) error
- func (i *InMemory) Delete(key string) error
- func (i *InMemory) Get(key string, resource string) (int, error)
- func (i *InMemory) Has(key string) bool
- func (i *InMemory) Options() *Options
- type Options
- type Redis
- func (r *Redis) Add(key string, resource string, now time.Time) (int, error)
- func (r *Redis) Connect() error
- func (r *Redis) Create(key string, resource string) error
- func (r Redis) Delete(key string) error
- func (r *Redis) Get(key string, resource string) (int, error)
- func (r *Redis) Has(key string) bool
- func (r *Redis) Options() *Options
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemory ¶
type InMemory struct {
// contains filtered or unexported fields
}
InMemory holds the options and for with in memory key-value data store
func NewInMemory ¶
NewInMemory returns new InMemory client
func (*InMemory) Add ¶ added in v0.2.0
Add new hit for particular 'resource' in particular time bucket 'key'
func (*InMemory) Create ¶ added in v0.2.0
Create bucket in InMemory for specitic time slot and resource name
type Options ¶
Options respresents the available options to be passed to data store implementations. These can be set with flags through the CLI or environment variable to Docker container.
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
Redis holds the client and options for connecting and working against Redis
func NewRedis ¶
NewRedis returns new Redis client with provided URL and port and password through CLI options
func (*Redis) Add ¶ added in v0.2.0
Add new hit for particular 'resource' in particular time bucket 'key'
func (*Redis) Create ¶ added in v0.2.0
Create bucket in Redis for specitic time slot and resource name
type Store ¶
type Store interface { // Options returns the current options passed to Store Options() *Options // Connect connects to Store database Connect() error // Has checks if the time slot bucket 'key' exists Has(key string) bool // Get hits count based on bucket key and resource name Get(key string, resource string) (int, error) // Create bucket for specitic time slot and resource name Create(key string, resource string) error // Add new hit for particular 'resource' in particular time bucket 'key' Add(key string, resource string, now time.Time) (int, error) // Delete a specific 'key' time bucket Delete(key string) error }
Store respresents an interface of type of data store which gets implemented in different types, e.g. Redis, InMemory, etc.