cache

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CacheExpiryDuration is how long the cache is valid (1 minute for rate limiting)
	CacheExpiryDuration = 1 * time.Minute
	// DefaultCacheFile is the default location for the export cache
	DefaultCacheFile = ".workflowy/export-cache.json"
)

Variables

This section is empty.

Functions

func GetCacheAge

func GetCacheAge(cache *ExportCache) time.Duration

GetCacheAge returns the age of the cache in seconds

func GetCachePath

func GetCachePath() (string, error)

GetCachePath returns the full path to the cache file

func IsCacheValid

func IsCacheValid(cache *ExportCache) bool

IsCacheValid checks if the cache exists and is within the expiry duration

func WriteExportCache

func WriteExportCache(data interface{}) error

WriteExportCache writes the export data to cache with current timestamp data should be any type that can be marshaled to JSON

Types

type ExportCache

type ExportCache struct {
	Timestamp int64           `json:"timestamp"`
	Data      json.RawMessage `json:"data"`
}

ExportCache represents the cached export data with timestamp Data is stored as raw JSON to avoid circular dependencies

func ReadExportCache

func ReadExportCache() (*ExportCache, error)

ReadExportCache reads the cached export data if it exists and is valid

Jump to

Keyboard shortcuts

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