cache

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMiss = errors.New("cache miss")
)

Functions

func AutharaUserKey

func AutharaUserKey(userID string) string

func RateLimitKey

func RateLimitKey(kind, scope, value string) string

func RevokedAccessTokenKey added in v0.13.0

func RevokedAccessTokenKey(tokenHash string) string

func RevokedAccessTokenMembershipKey added in v0.13.0

func RevokedAccessTokenMembershipKey(userID, organizationID string) string

func RevokedAccessTokenSessionKey added in v0.13.0

func RevokedAccessTokenSessionKey(sessionID string) string

func RevokedAccessTokenUserKey added in v0.13.0

func RevokedAccessTokenUserKey(userID string) string

Types

type Cache

type Cache interface {
	Get(ctx context.Context, key string) ([]byte, error)
	GetMany(ctx context.Context, keys ...string) ([][]byte, error)
	Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
	Delete(ctx context.Context, key string) error
	Close() error
}

type Counter

type Counter interface {
	Increment(ctx context.Context, key string, ttl time.Duration) (count int64, remainingTTL time.Duration, err error)
}

type Noop

type Noop struct{}

func NewNoop

func NewNoop() *Noop

func (*Noop) Close

func (n *Noop) Close() error

func (*Noop) Delete

func (n *Noop) Delete(ctx context.Context, key string) error

func (*Noop) Get

func (n *Noop) Get(ctx context.Context, key string) ([]byte, error)

func (*Noop) GetMany added in v0.13.0

func (n *Noop) GetMany(ctx context.Context, keys ...string) ([][]byte, error)

func (*Noop) Set

func (n *Noop) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error

type Redis

type Redis struct {
	// contains filtered or unexported fields
}

func NewRedis

func NewRedis(cfg RedisConfig) (*Redis, error)

func (*Redis) Close

func (r *Redis) Close() error

func (*Redis) Delete

func (r *Redis) Delete(ctx context.Context, key string) error

func (*Redis) Get

func (r *Redis) Get(ctx context.Context, key string) ([]byte, error)

func (*Redis) GetMany added in v0.13.0

func (r *Redis) GetMany(ctx context.Context, keys ...string) ([][]byte, error)

func (*Redis) Increment

func (r *Redis) Increment(
	ctx context.Context,
	key string,
	ttl time.Duration,
) (count int64, remainingTTL time.Duration, err error)

func (*Redis) Set

func (r *Redis) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error

type RedisConfig

type RedisConfig struct {
	Host     string
	Port     int
	Password string
	DB       int
}

Jump to

Keyboard shortcuts

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