Documentation ¶
Overview ¶
Package cache provides an in-memory LRU cache for reducing the duplicate workload of database requests and post HTML and JSON generation
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Size sets the maximum size of cache before evicting unread data in MB Size float64 = 1 << 7 )
Functions ¶
Types ¶
type FrontEnd ¶
type FrontEnd struct { // GetCounter retrieves a new update counter for a resource GetCounter func(Key) (uint64, error) // GetFresh retrieves new post data from the database GetFresh func(Key) (easyjson.Marshaler, error) // RenderHTML produces HTML from the passed in data and JSON RenderHTML func(easyjson.Marshaler, []byte) []byte }
FrontEnd provides functions for fetching, validating and generating the cache. GetCounter and GetFresh are mandatory, but you may omit RenderHTML, if you don't plan to call GetHTML with this FrontEnd.
Click to show internal directories.
Click to hide internal directories.