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.
func (*CachedPublication) Release ¶ added in v0.9.1
func (cp *CachedPublication) Release()
Release drops one reader's hold on the publication, closing it if the cache has already evicted the entry and this was the last reader.
func (*CachedPublication) Retain ¶ added in v0.9.1
func (cp *CachedPublication) Retain() bool
Retain marks the publication as in-use by one more reader. It returns false if the publication has already been closed, in which case the caller must not use it and should re-open. Every successful Retain must be paired with a Release.
type LocalCache ¶
type TinyLFU ¶
type TinyLFU struct {
// contains filtered or unexported fields
}