inmemory

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DefaultExpiration int32
	CleanupInterval   int32
}

Config is the configuration for the in-memory cache

type InMemoryCache

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

InMemoryCache holds the handler for the in-memory cache using go-cache

func NewCache

func NewCache(config *Config) (*InMemoryCache, error)

InMemoryCacheConfig is the configuration for the in-memory cache

func (*InMemoryCache) Delete

func (imc *InMemoryCache) Delete(ctx context.Context, key string) error

Delete implements Cache.

func (*InMemoryCache) Flush

func (imc *InMemoryCache) Flush(ctx context.Context)

Flushes out all the keys from Cache.

func (*InMemoryCache) Get

func (imc *InMemoryCache) Get(ctx context.Context, key string) (interface{}, error)

Get implements Cache.

func (*InMemoryCache) GetByPattern added in v0.2.0

func (imc *InMemoryCache) GetByPattern(ctx context.Context, keyPattern string) (map[string]interface{}, error)

GetByPattern like implements Cache.

func (*InMemoryCache) ScanKeys added in v0.2.0

func (imc *InMemoryCache) ScanKeys(ctx context.Context, pattern string) ([]string, error)

ScanKeys returns all keys matching the given pattern from in-memory cache Pattern is a glob pattern (like Redis SCAN), where * matches any sequence of characters and ? matches any single character

func (*InMemoryCache) Set

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

Set implements inmemory

Jump to

Keyboard shortcuts

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