cache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxEntries = 500
	MaxAge            = 30 * 24 * time.Hour // 30 days
	CacheVersion      = "1.0"
)

Variables

This section is empty.

Functions

func GetDefaultCacheDir

func GetDefaultCacheDir() (string, error)

Types

type Cache

type Cache struct {
	Version       string       `json:"version"`
	LastSync      time.Time    `json:"last_sync"`
	Notifications []CacheEntry `json:"notifications"`
	MaxEntries    int          `json:"max_entries"`
}

func New

func New(cacheDir string) *Cache

func (*Cache) AddNotifications

func (c *Cache) AddNotifications(notifications []CacheEntry) []CacheEntry

func (*Cache) Clear

func (c *Cache) Clear()

func (*Cache) GetNotifications

func (c *Cache) GetNotifications() []CacheEntry

func (*Cache) Load

func (c *Cache) Load(cacheDir string) error

func (*Cache) Save

func (c *Cache) Save(cacheDir string) error

type CacheEntry

type CacheEntry struct {
	ID         string    `json:"id"`
	Repository string    `json:"repository"`
	Title      string    `json:"title"`
	Reason     string    `json:"reason"`
	Type       string    `json:"type"`
	URL        string    `json:"url"`
	WebURL     string    `json:"web_url"`
	Timestamp  time.Time `json:"timestamp"`
	UpdatedAt  time.Time `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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