datastore

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDynamoDBDatastore

func NewDynamoDBDatastore(
	cfg aws.Config,
	tableName string,
	keyGetter func(identifier string) map[string]string,
	ttlAttr string,
	countAttr string,
) *dynamoDBDatastore

Types

type Datastore

type Datastore interface {
	// Responsible for incrementing keys. Returns the post increment counts.
	//
	// Should also add relevant expiry based on MaxLifespan of keys to ensure cleanup. Ideally the expiry should be set on the first increment of the key.
	IncrKeys(ctx context.Context, keys []KeyConfig) ([]int, []error)
}

type KeyConfig

type KeyConfig struct {
	Key         string
	MaxLifespan time.Duration
}

type RedisDatastore added in v1.0.3

type RedisDatastore struct {
	Client        *redis.Client
	ClusterClient *redis.ClusterClient
}

RedisDatastore represents a datastore backed by Redis.

func (RedisDatastore) IncrKeys added in v1.0.3

func (r RedisDatastore) IncrKeys(ctx context.Context, keys []KeyConfig) ([]int, []error)

IncrKeys increments the keys in Redis and sets an expiration time on the first increment.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL