Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
func NewEncoder ¶
NewEncoder creates a cache.Encoder that maintains a cache of already decoded JSON bytes of events to prevent doubling up of both decoding work and JSON bytes usage for multiple concurrent requests of overlapping events by clients.
func (*Encoder) Get ¶
Get retrieves the encoded JSON for a given event if it is cached.
If ok is false, then the caller needs to fetch the event from elsewhere.
func (*Encoder) Put ¶
Put stores an event's encoded JSON form for access by concurrent client requests. Call this with an event decoded from the database so that concurrent queries that match it can avoid repeated decode/allocate steps.
If the json is available as well, skip re-encoding it. If the event is already in the cache, return the json.