cache

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*abs.Client
	// contains filtered or unexported fields
}

Client is a transparent caching wrapper around abs.Client.

func NewClient

func NewClient(inner *abs.Client, store *Store) *Client

NewClient creates a caching wrapper around the given ABS client.

func (*Client) FilterAudioLibraries

func (c *Client) FilterAudioLibraries(ctx context.Context, libs []abs.Library) ([]abs.Library, error)

FilterAudioLibraries filters audio libraries using cache or fetches from the API.

func (*Client) GetBookmarks

func (c *Client) GetBookmarks(ctx context.Context, itemID string) ([]abs.Bookmark, error)

GetBookmarks returns bookmarks from cache or fetches from the API.

func (*Client) GetLibraries

func (c *Client) GetLibraries(ctx context.Context) ([]abs.Library, error)

GetLibraries returns libraries from cache or fetches from the API.

func (*Client) GetLibraryItem

func (c *Client) GetLibraryItem(ctx context.Context, itemID string) (*abs.LibraryItem, error)

GetLibraryItem returns a single library item from cache or fetches from the API.

func (*Client) GetLibraryItems

func (c *Client) GetLibraryItems(ctx context.Context, libraryID string, page, limit int) (*abs.LibraryItemsResponse, error)

GetLibraryItems returns a paginated list of library items from cache or fetches from the API.

func (*Client) GetLibrarySeries

func (c *Client) GetLibrarySeries(ctx context.Context, libraryID string, page, limit int) (*abs.LibrarySeriesResponse, error)

GetLibrarySeries returns a paginated list of series from cache or fetches from the API.

func (*Client) GetMediaProgress

func (c *Client) GetMediaProgress(ctx context.Context, itemID string) (*abs.MediaProgressWithBookmarks, error)

GetMediaProgress returns media progress from cache or fetches from the API.

func (*Client) GetPersonalized

func (c *Client) GetPersonalized(ctx context.Context, libraryID string) ([]abs.PersonalizedResponse, error)

GetPersonalized returns personalized shelves from cache or fetches from the API.

func (*Client) GetRecentEpisodes

func (c *Client) GetRecentEpisodes(ctx context.Context, libraryID string, limit int) ([]abs.LibraryItem, error)

GetRecentEpisodes returns recent podcast episodes from cache or fetches from the API.

func (*Client) GetRecentlyAdded

func (c *Client) GetRecentlyAdded(ctx context.Context, libraries []abs.Library) ([]abs.LibraryItem, error)

GetRecentlyAdded returns the merged recently-added shelf from cache or fetches from the API.

func (*Client) GetSeries

func (c *Client) GetSeries(ctx context.Context, libraryID, seriesID string) (*abs.Series, error)

GetSeries returns series metadata from cache or fetches from the API.

func (*Client) GetSeriesContents

func (c *Client) GetSeriesContents(ctx context.Context, libraryID, seriesID string) (*abs.SeriesContents, error)

GetSeriesContents returns series contents from cache or fetches from the API.

type Store

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

Store provides generic get/put/delete/evict operations over a SQLite table.

func NewStore

func NewStore(db *db.Store) *Store

NewStore creates a cache backed by the given database.

func (*Store) Delete

func (s *Store) Delete(key string) error

Delete removes the entry for key.

func (*Store) EvictExpired

func (s *Store) EvictExpired() error

EvictExpired removes all expired entries.

func (*Store) Get

func (s *Store) Get(key string, dest any) (bool, error)

Get attempts to retrieve and decode the value for key into dest. Returns (true, nil) on hit, (false, nil) on miss.

func (*Store) GetBookmarks

func (s *Store) GetBookmarks(itemID string) ([]abs.Bookmark, bool, error)

func (*Store) GetEpisodes

func (s *Store) GetEpisodes(itemID string) ([]abs.PodcastEpisode, bool, error)

func (*Store) GetFilteredLibraries

func (s *Store) GetFilteredLibraries() ([]abs.Library, bool, error)

func (*Store) GetLibraries

func (s *Store) GetLibraries() ([]abs.Library, bool, error)

func (*Store) GetLibraryItem

func (s *Store) GetLibraryItem(itemID string) (*abs.LibraryItem, bool, error)

func (*Store) GetLibraryItems

func (s *Store) GetLibraryItems(libID string, page int) ([]abs.LibraryItem, int, bool, error)

func (*Store) GetLibrarySeries

func (s *Store) GetLibrarySeries(libID string, page int) ([]abs.Series, int, bool, error)

func (*Store) GetMediaProgress

func (s *Store) GetMediaProgress(itemID string) (*abs.MediaProgressWithBookmarks, bool, error)

func (*Store) GetPersonalized

func (s *Store) GetPersonalized(libID string) ([]abs.PersonalizedResponse, bool, error)

func (*Store) GetRecentEpisodes

func (s *Store) GetRecentEpisodes(libID string, limit int) ([]abs.LibraryItem, bool, error)

func (*Store) GetRecentlyAdded

func (s *Store) GetRecentlyAdded() ([]abs.LibraryItem, bool, error)

func (*Store) GetSeries

func (s *Store) GetSeries(seriesID string) (*abs.Series, bool, error)

func (*Store) GetSeriesContents

func (s *Store) GetSeriesContents(seriesID string) ([]abs.LibraryItem, bool, error)

func (*Store) Put

func (s *Store) Put(key string, value any, ttl time.Duration) error

Put gob-encodes value and stores it with the given TTL.

func (*Store) PutBookmarks

func (s *Store) PutBookmarks(itemID string, v []abs.Bookmark, ttl time.Duration) error

func (*Store) PutEpisodes

func (s *Store) PutEpisodes(itemID string, v []abs.PodcastEpisode, ttl time.Duration) error

func (*Store) PutFilteredLibraries

func (s *Store) PutFilteredLibraries(v []abs.Library, ttl time.Duration) error

func (*Store) PutLibraries

func (s *Store) PutLibraries(v []abs.Library, ttl time.Duration) error

func (*Store) PutLibraryItem

func (s *Store) PutLibraryItem(itemID string, v *abs.LibraryItem, ttl time.Duration) error

func (*Store) PutLibraryItems

func (s *Store) PutLibraryItems(libID string, page int, items []abs.LibraryItem, total int, ttl time.Duration) error

func (*Store) PutLibrarySeries

func (s *Store) PutLibrarySeries(libID string, page int, items []abs.Series, total int, ttl time.Duration) error

func (*Store) PutMediaProgress

func (s *Store) PutMediaProgress(itemID string, v *abs.MediaProgressWithBookmarks, ttl time.Duration) error

func (*Store) PutPersonalized

func (s *Store) PutPersonalized(libID string, v []abs.PersonalizedResponse, ttl time.Duration) error

func (*Store) PutRecentEpisodes

func (s *Store) PutRecentEpisodes(libID string, limit int, v []abs.LibraryItem, ttl time.Duration) error

func (*Store) PutRecentlyAdded

func (s *Store) PutRecentlyAdded(v []abs.LibraryItem, ttl time.Duration) error

func (*Store) PutSeries

func (s *Store) PutSeries(seriesID string, v *abs.Series, ttl time.Duration) error

func (*Store) PutSeriesContents

func (s *Store) PutSeriesContents(seriesID string, v []abs.LibraryItem, ttl time.Duration) error

Jump to

Keyboard shortcuts

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