cache

package
v1.2.1 Latest Latest
Warning

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

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

type CacheContent

type CacheContent = map[string]rss.RSS

key is feedurl

type CacheInterface added in v1.1.7

type CacheInterface interface {
	Write(key string, content rss.RSS) error
	Read(key string) (rss.RSS, error)
}

func NewFileCache added in v1.1.7

func NewFileCache(path string, expiry time.Duration) CacheInterface

func NewMemoryCache added in v1.1.7

func NewMemoryCache() CacheInterface

type FileCache added in v1.1.7

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

func (*FileCache) Read added in v1.1.7

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

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

func (*FileCache) Write added in v1.1.7

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

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

type MemoryCache added in v1.1.7

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

func (*MemoryCache) Read added in v1.1.7

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

func (*MemoryCache) Write added in v1.1.7

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

Jump to

Keyboard shortcuts

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