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 ¶
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
Click to show internal directories.
Click to hide internal directories.