cache

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JITCache

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

JITCache provides LRU + TTL caching for JIT-rendered pages. Not safe for concurrent use — callers must hold the lock.

func NewJITCache

func NewJITCache(maxSize int, defaultTTL time.Duration) *JITCache

NewJITCache creates a JITCache with the given max entry count and default TTL.

func (*JITCache) Clear

func (c *JITCache) Clear()

Clear removes all entries.

func (*JITCache) Get

func (c *JITCache) Get(path string) *JITEntry

Get retrieves a cached entry. Returns nil if not found or expired.

func (*JITCache) Len

func (c *JITCache) Len() int

Len returns the number of cached entries.

func (*JITCache) Remove

func (c *JITCache) Remove(path string)

Remove deletes a cached entry.

func (*JITCache) Set

func (c *JITCache) Set(path string, entry *JITEntry)

Set adds or updates a cached entry.

type JITEntry

type JITEntry struct {
	Path        string
	HTML        []byte
	Size        int64
	ContentType string
	RenderedAt  time.Time
	TTL         time.Duration
}

JITEntry holds a single JIT-rendered page.

type RenderCache

type RenderCache struct {
	JIT  *JITCache
	Root string
}

RenderCache provides the interface for the full-cache operations. Phase 1: pass-through to JITCache. Phase 2: add full cache + incr cache.

func NewRenderCache

func NewRenderCache(root string, jitMaxSize int, jitTTL time.Duration) *RenderCache

NewRenderCache creates a RenderCache.

Jump to

Keyboard shortcuts

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