memorystore

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 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 KV

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

KV is a simple in-memory key-value store with TTL support. It is only safe for single-process deployments.

func NewKV

func NewKV() *KV

func (*KV) Del

func (k *KV) Del(ctx context.Context, key string) error

func (*KV) Get

func (k *KV) Get(ctx context.Context, key string) ([]byte, bool, error)

func (*KV) Set

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

type SIWSCache

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

SIWSCache stores pending SIWS challenges in memory. This is only suitable for single-node deployments or local development.

func NewSIWSCache

func NewSIWSCache(ttl time.Duration) *SIWSCache

NewSIWSCache creates a new in-memory SIWS challenge cache.

func (*SIWSCache) Del

func (c *SIWSCache) Del(ctx context.Context, nonce string) error

Del removes a challenge from memory.

func (*SIWSCache) Get

func (c *SIWSCache) Get(ctx context.Context, nonce string) (siws.ChallengeData, bool, error)

Get retrieves a challenge from memory.

func (*SIWSCache) Put

func (c *SIWSCache) Put(ctx context.Context, nonce string, data siws.ChallengeData) error

Put stores a challenge in memory.

type StateCache

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

StateCache is an in-memory implementation of oidckit.StateCache with TTL.

func NewStateCache

func NewStateCache(ttl time.Duration) *StateCache

NewStateCache creates a new in-memory state cache with the given TTL. If ttl <= 0, a default of 10 minutes is used. Starts a background goroutine to clean up expired entries every minute.

func (*StateCache) Close

func (s *StateCache) Close() error

Close stops the background cleanup goroutine. Should be called when the cache is no longer needed.

func (*StateCache) Del

func (s *StateCache) Del(ctx context.Context, state string) error

func (*StateCache) Get

func (s *StateCache) Get(ctx context.Context, state string) (oidckit.StateData, bool, error)

func (*StateCache) Put

func (s *StateCache) Put(ctx context.Context, state string, v oidckit.StateData) error

Jump to

Keyboard shortcuts

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