Documentation
¶
Index ¶
- Constants
- type EngineCache
- type ImageCache
- func (ic *ImageCache) Clear(ctx context.Context) error
- func (ic *ImageCache) GetCachedImagePath(ctx context.Context, imageURL string) (string, error)
- func (ic *ImageCache) GetCachedImageURL(imageURL string) string
- func (ic *ImageCache) ServeImage(ctx context.Context, mediaID uint, w http.ResponseWriter, r *http.Request) error
- type JellyfinItem
- type JellyfinItemsData
- type PrefixedCache
- func (p *PrefixedCache[T]) Clear(ctx context.Context) error
- func (p *PrefixedCache[T]) Delete(ctx context.Context, key any) error
- func (p *PrefixedCache[T]) Get(ctx context.Context, key any) (T, error)
- func (p *PrefixedCache[T]) GetStats() *codec.Stats
- func (p *PrefixedCache[T]) GetType() string
- func (p *PrefixedCache[T]) Invalidate(ctx context.Context, options ...store.InvalidateOption) error
- func (p *PrefixedCache[T]) Set(ctx context.Context, key any, object T, options ...store.Option) error
- type Stats
- type TagMap
Constants ¶
const ( JellyfinItemsCachePrefix = "jellyfin-items-" SonarrItemsCachePrefix = "sonarr-items-" SonarrTagsCachePrefix = "sonarr-tags-" RadarrItemsCachePrefix = "radarr-items-" RadarrTagsCachePrefix = "radarr-tags-" )
Cache key prefixes.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EngineCache ¶
type EngineCache struct {
SonarrTagsCache *PrefixedCache[TagMap]
RadarrTagsCache *PrefixedCache[TagMap]
}
func NewEngineCache ¶
func NewEngineCache(cfg *config.CacheConfig) (*EngineCache, error)
func (*EngineCache) ClearAll ¶
func (e *EngineCache) ClearAll(ctx context.Context)
func (*EngineCache) GetStats ¶
func (e *EngineCache) GetStats() []*Stats
type ImageCache ¶
type ImageCache struct {
// contains filtered or unexported fields
}
func NewImageCache ¶
func NewImageCache(cacheDir string, db database.MediaDB) *ImageCache
NewImageCache creates a new image cache manager with scaling options.
func (*ImageCache) Clear ¶
func (ic *ImageCache) Clear(ctx context.Context) error
Clear clears the image cache directory without removing the directory itself.
func (*ImageCache) GetCachedImagePath ¶
GetCachedImagePath returns the local path for an image, downloading it if necessary.
func (*ImageCache) GetCachedImageURL ¶
func (ic *ImageCache) GetCachedImageURL(imageURL string) string
GetCachedImageURL returns a local URL for an image, downloading it if necessary.
func (*ImageCache) ServeImage ¶
func (ic *ImageCache) ServeImage(ctx context.Context, mediaID uint, w http.ResponseWriter, r *http.Request) error
ServeImage serves a cached image or downloads it if not cached.
type JellyfinItem ¶
type JellyfinItem struct {
jellyfin.BaseItemDto
ParentLibraryName string `json:"parentLibraryName,omitempty"`
}
JellyfinItem represents a Jellyfin media item with its library context.
type JellyfinItemsData ¶
type JellyfinItemsData struct {
Items []JellyfinItem `json:"items"`
}
JellyfinItemsData contains cached Jellyfin items.
type PrefixedCache ¶
type PrefixedCache[T any] struct { // contains filtered or unexported fields }
PrefixedCache wraps a cache.Cache and adds a prefix to all keys.
func NewPrefixedCache ¶
func NewPrefixedCache[T any](cache *cache.Cache[any], cacheType config.CacheType, prefix string) *PrefixedCache[T]
NewPrefixedCache creates a new prefixed cache wrapper.
func (*PrefixedCache[T]) Clear ¶
func (p *PrefixedCache[T]) Clear(ctx context.Context) error
Clear removes all values from the cache.
func (*PrefixedCache[T]) Delete ¶
func (p *PrefixedCache[T]) Delete(ctx context.Context, key any) error
Delete removes a value from the cache with the prefixed key.
func (*PrefixedCache[T]) Get ¶
func (p *PrefixedCache[T]) Get(ctx context.Context, key any) (T, error)
Get retrieves a value from the cache with the prefixed key.
func (*PrefixedCache[T]) GetStats ¶
func (p *PrefixedCache[T]) GetStats() *codec.Stats
GetStats returns the cache statistics.
func (*PrefixedCache[T]) GetType ¶
func (p *PrefixedCache[T]) GetType() string
GetType returns the cache type.
func (*PrefixedCache[T]) Invalidate ¶
func (p *PrefixedCache[T]) Invalidate(ctx context.Context, options ...store.InvalidateOption) error
Invalidate removes values from the cache matching the prefixed pattern.