cache

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SimpleCachePlugin

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

SimpleCachePlugin implements the easyrest.CachePlugin interface using an in-memory cache with expiring keys based on github.com/patrickmn/go-cache. Note: This is not strictly LRU, but provides the required Set-with-TTL functionality.

func NewSimpleCachePlugin

func NewSimpleCachePlugin() *SimpleCachePlugin

NewSimpleCachePlugin creates a new instance of SimpleCachePlugin.

func (*SimpleCachePlugin) Get

func (p *SimpleCachePlugin) Get(key string) (string, error)

Get retrieves the value associated with the key.

func (*SimpleCachePlugin) InitConnection

func (p *SimpleCachePlugin) InitConnection(uri string) error

InitConnection initializes the cache. The URI is currently ignored for the in-memory implementation.

func (*SimpleCachePlugin) Set

func (p *SimpleCachePlugin) Set(key string, value string, ttl time.Duration) error

Set adds or updates a key-value pair with a specific TTL.

Jump to

Keyboard shortcuts

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