cache

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(e *echo.Group, h *Handler, authMiddleware *auth.Middleware)

RegisterRoutes registers cache management routes on the given echo instance. GET /cache requires config:read; POST /cache/:id/clear requires config:write.

func RegisterSettingsRoutes added in v0.2.0

func RegisterSettingsRoutes(e *echo.Group, authMiddleware *auth.Middleware, store *appsettings.Service, thumbnails *covers.ThumbnailCache)

RegisterSettingsRoutes registers persisted policy alongside other admin settings.

Types

type ClearResponse

type ClearResponse struct {
	ClearedBytes int64 `json:"cleared_bytes"`
	ClearedFiles int   `json:"cleared_files"`
}

ClearResponse is returned from POST /cache/:id/clear.

type Handler

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

Handler exposes HTTP endpoints for cache management.

func NewHandler

func NewHandler(downloads, cbzPages, pdfPages, coverThumbnails Provider) *Handler

NewHandler returns a new cache management handler.

type Info

type Info struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	SizeBytes   int64  `json:"size_bytes"`
	FileCount   int    `json:"file_count"`
}

Info describes one cache. GET /cache returns a bare array of them. The type name avoids stuttering (cache.Info instead of cache.CacheInfo).

type Provider

type Provider interface {
	SizeBytes() (int64, int, error)
	Clear() error
}

Provider is the minimal interface a cache must implement to be managed.

type SettingsResponse added in v0.2.0

type SettingsResponse struct {
	CoverThumbnailMaxSizeGB float64 `json:"cover_thumbnail_max_size_gb"`
}

SettingsResponse contains the admin-editable cache policy.

func LoadSettings added in v0.2.0

func LoadSettings(ctx context.Context, store *appsettings.Service) (SettingsResponse, error)

LoadSettings reads saved policy without persisting defaults on a GET.

type UpdateSettingsPayload added in v0.2.0

type UpdateSettingsPayload struct {
	CoverThumbnailMaxSizeGB *float64 `json:"cover_thumbnail_max_size_gb,omitempty" validate:"omitempty,min=0,max=1024"`
}

UpdateSettingsPayload allows individual cache policies to be changed.

Jump to

Keyboard shortcuts

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