cache

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultExpiry time.Duration = 24 * 60 * 60 * 1000 * 1000 * 1000

h * m * s * ms * μs * ns 24hrs

Variables

View Source
var DefaultPath = filepath.Join(os.TempDir(), "nom")
View Source
var ErrCacheMiss = errors.New("cache miss")

Functions

This section is empty.

Types

type Cache

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

func New

func New(path string, expiry time.Duration) Cache

creates a new cache

func (*Cache) Read

func (c *Cache) Read(key string) (rss.RSS, error)

Read reads from the cache, returning a ErrCacheMiss if nothing found or if the cache is older than the expiry

func (*Cache) Write

func (c *Cache) Write(key string, content rss.RSS) error

Write writes content to a file at the location specified in the cache

type CacheContent

type CacheContent = map[string]rss.RSS

key is feedurl

Jump to

Keyboard shortcuts

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