state

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryStore

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

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) Delete

func (s *MemoryStore) Delete(ctx context.Context, key string) error

func (*MemoryStore) Exists

func (s *MemoryStore) Exists(ctx context.Context, key string) (bool, error)

func (*MemoryStore) Get

func (s *MemoryStore) Get(ctx context.Context, key string) (string, bool, error)

func (*MemoryStore) Incr

func (s *MemoryStore) Incr(ctx context.Context, key string, ttl time.Duration) (int64, error)

func (*MemoryStore) Set

func (s *MemoryStore) Set(ctx context.Context, key string, value string, ttl time.Duration) error

func (*MemoryStore) SetNX

func (s *MemoryStore) SetNX(ctx context.Context, key string, value string, ttl time.Duration) (bool, error)

func (*MemoryStore) TTL

func (s *MemoryStore) TTL(ctx context.Context, key string) (time.Duration, bool, error)

type RedisStore

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

func NewRedisStore

func NewRedisStore(client redis.Cmdable) *RedisStore

func (*RedisStore) Delete

func (s *RedisStore) Delete(ctx context.Context, key string) error

func (*RedisStore) Exists

func (s *RedisStore) Exists(ctx context.Context, key string) (bool, error)

func (*RedisStore) Get

func (s *RedisStore) Get(ctx context.Context, key string) (string, bool, error)

func (*RedisStore) Incr

func (s *RedisStore) Incr(ctx context.Context, key string, ttl time.Duration) (int64, error)

func (*RedisStore) Set

func (s *RedisStore) Set(ctx context.Context, key string, value string, ttl time.Duration) error

func (*RedisStore) SetNX

func (s *RedisStore) SetNX(ctx context.Context, key string, value string, ttl time.Duration) (bool, error)

func (*RedisStore) TTL

func (s *RedisStore) TTL(ctx context.Context, key string) (time.Duration, bool, error)

type Store

type Store interface {
	Incr(ctx context.Context, key string, ttl time.Duration) (int64, error)
	Set(ctx context.Context, key string, value string, ttl time.Duration) error
	SetNX(ctx context.Context, key string, value string, ttl time.Duration) (bool, error)
	Get(ctx context.Context, key string) (string, bool, error)
	Exists(ctx context.Context, key string) (bool, error)
	TTL(ctx context.Context, key string) (time.Duration, bool, error)
	Delete(ctx context.Context, key string) error
}

Jump to

Keyboard shortcuts

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