cache

package
v0.6.10 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package cache provides a simple file-based cache implementation that fulfills the RefreshReadWriter interface.

It writes and reads the cache to a file in JSON format, along with the last refresh time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File added in v0.6.0

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

func NewFileCache

func NewFileCache(path string) *File

func (*File) Read added in v0.6.0

func (c *File) Read(out any) error

func (*File) Refresh added in v0.6.0

func (c *File) Refresh(t time.Time)

func (*File) RefreshedAt added in v0.6.0

func (c *File) RefreshedAt() time.Time

func (*File) Write added in v0.6.0

func (c *File) Write(in any) error

type RefreshReadWriter added in v0.5.0

type RefreshReadWriter interface {
	Read(d any) error
	Write(d any) error
	Refresh(t time.Time)
	RefreshedAt() time.Time
}

type Wrap added in v0.6.0

type Wrap struct {
	Data        any       `json:"data"`
	RefreshedAt time.Time `json:"refreshed_at"`
}

Jump to

Keyboard shortcuts

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