cache

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 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 Manager

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

Manager handles caching operations with TTL support

func NewManager

func NewManager(cacheDir string, ttl time.Duration) *Manager

NewManager creates a new cache manager

func (*Manager) Clear

func (m *Manager) Clear(dirPath string) error

Clear removes all cache files in a directory

func (*Manager) GetCacheDir

func (m *Manager) GetCacheDir() string

GetCacheDir returns the cache directory path

func (*Manager) GetFilePath

func (m *Manager) GetFilePath(subpath ...string) string

GetFilePath builds a cache file path within the cache directory

func (*Manager) GetTTL

func (m *Manager) GetTTL() time.Duration

GetTTL returns the cache TTL

func (*Manager) IsExpired

func (m *Manager) IsExpired(filePath string) (bool, error)

IsExpired checks if a file at the given path has expired based on cache TTL

func (*Manager) Load

func (m *Manager) Load(filePath string, v interface{}) (bool, error)

Load attempts to load data from cache. Returns true if loaded successfully, false if expired/not found

func (*Manager) Remove

func (m *Manager) Remove(filePath string) error

Remove removes a cache file

func (*Manager) Save

func (m *Manager) Save(filePath string, v interface{}) error

Save saves data to cache

Jump to

Keyboard shortcuts

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