lrucache

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

README


title: LRU Cache Plugin

Implements LRU (Least Recently Used) caching for query responses.

Type

  • Wrapper

Description

Caches query responses using an LRU strategy, with configurable cache size and TTL.

Configuration

lru_cache:
  max_size: 1000        # Maximum number of entries in cache
  ttl: "5m"            # Time-to-live for cached entries

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// MaxSize is the maximum number of entries the cache can hold
	MaxSize int `yaml:"max_size"`

	// TTL specifies how long entries should remain in cache
	// Format: time.Duration string ("5m", "1h", "24h")
	TTL time.Duration `yaml:"ttl"`
}

Config represents LRU cache configuration

func (Config) Doc

func (c Config) Doc() string

func (Config) Tag

func (c Config) Tag() string

type Connector

type Connector struct {
	connectors.Connector
	// contains filtered or unexported fields
}

func (Connector) Query

func (c Connector) Query(ctx context.Context, endpoint model.Endpoint, params map[string]any) ([]map[string]any, error)

type Plugin

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

func (Plugin) Doc

func (p Plugin) Doc() string

func (Plugin) Wrap

func (p Plugin) Wrap(connector connectors.Connector) (connectors.Connector, error)

type PluginBundle

type PluginBundle interface {
	plugins.Wrapper
}

func New

func New(cfg Config) (PluginBundle, error)

Jump to

Keyboard shortcuts

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