Documentation ¶
Index ¶
- type MetricsHook
- type Snapshot
- func (s *Snapshot) Cancel()
- func (s *Snapshot) Check() error
- func (s *Snapshot) Flush(flushDone func() error) error
- func (s *Snapshot) Get(key string, clone cloner) (interface{}, bool, error)
- func (s *Snapshot) Has(key string) bool
- func (s *Snapshot) Keys() []string
- func (s *Snapshot) Set(key string, value interface{}, encoded bool, flush flusher, evict evicter)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetricsHook ¶
type Snapshot ¶
type Snapshot struct { MetricsHook MetricsHook // contains filtered or unexported fields }
func New ¶
New create a new snapshot with a barrier for n external goroutines plus internal go routines.
func (*Snapshot) Cancel ¶
func (s *Snapshot) Cancel()
Cancel the Snapshot from Flushing/Checking of the Snapshot. Mostly for shutdown.
func (*Snapshot) Flush ¶
Flush swaps the current Snapshot to stable. To avoid the user-goroutines changing the states at the same time, it synchronizes using a barrier. After swap, it flushes all stable entries. This function must never be executed concurrently, otherwise it will panic.
func (*Snapshot) Get ¶
Get returns a value from the Snapshot identified by passed key. It will search in the current Snapshot and returns its value directly,git otherwise check in the last Snapshot (stable) and return a cloned value.