cache

package
v0.3.18 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(key string) (interface{}, bool)
	Set(key string, value interface{})
	Delete(key string)
	Clear() error
}

Cache defines the interface for caching

type FileCache

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

FileCache implements file-based caching

func NewFileCache

func NewFileCache(directory string, ttl time.Duration) (*FileCache, error)

NewFileCache creates a new file-based cache

func (*FileCache) Clear

func (c *FileCache) Clear() error

Clear removes all cached values

func (*FileCache) Delete

func (c *FileCache) Delete(key string)

Delete removes a value from the cache

func (*FileCache) Get

func (c *FileCache) Get(key string) (interface{}, bool)

Get retrieves a value from the cache

func (*FileCache) Set

func (c *FileCache) Set(key string, value interface{})

Set stores a value in the cache

type NoopCache

type NoopCache struct{}

NoopCache is a cache that doesn't cache anything

func NewNoopCache

func NewNoopCache() *NoopCache

NewNoopCache creates a new no-op cache

func (*NoopCache) Clear

func (c *NoopCache) Clear() error

Clear does nothing

func (*NoopCache) Delete

func (c *NoopCache) Delete(key string)

Delete does nothing

func (*NoopCache) Get

func (c *NoopCache) Get(key string) (interface{}, bool)

Get always returns false

func (*NoopCache) Set

func (c *NoopCache) Set(key string, value interface{})

Set does nothing

Jump to

Keyboard shortcuts

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