cache

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedPublication

type CachedPublication struct {
	*pub.Publication
	Session  *session.ReadingSessionDocument
	Remote   bool
	CachedAt time.Time

	Mu sync.RWMutex
	// contains filtered or unexported fields
}

CachedPublication implements Evictable

func EncapsulatePublication

func EncapsulatePublication(p *pub.Publication, doc *session.ReadingSessionDocument, remote bool) *CachedPublication

func (*CachedPublication) OnEvict

func (cp *CachedPublication) OnEvict()

func (*CachedPublication) RefreshSession added in v0.7.0

func (cp *CachedPublication) RefreshSession(doc *session.ReadingSessionDocument)

RefreshSession swaps in a freshly-fetched reading session document and re-applies its metadata/links/rights onto the existing publication in place, avoiding an expensive reopen. The publication's injected rights service is updated atomically; the manifest mutation is guarded by Mu.

type Evictable

type Evictable interface {
	OnEvict()
}

type LocalCache

type LocalCache interface {
	Set(key string, data Evictable)
	Get(key string) (Evictable, bool)
	Del(key string)
}

type TinyLFU

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

func NewTinyLFU

func NewTinyLFU(size int, ttl time.Duration) *TinyLFU

func (*TinyLFU) Del

func (c *TinyLFU) Del(key string)

func (*TinyLFU) Get

func (c *TinyLFU) Get(key string) (Evictable, bool)

func (*TinyLFU) Set

func (c *TinyLFU) Set(key string, b Evictable)

func (*TinyLFU) UseRandomizedTTL

func (c *TinyLFU) UseRandomizedTTL(offset time.Duration)

Jump to

Keyboard shortcuts

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