cache

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HitCache

type HitCache interface {
	HandleHit(string)
	AddHit(string) error
	Items() map[string]int
	Clear()
	OnCron()
}

HitCache is an interface for all cache backends

type HitGoCache

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

HitGoCache implements the HitCache interface for go-cache

func NewHitGoCache

func NewHitGoCache() *HitGoCache

NewHitGoCache is a constructor for HitGoCache

func (*HitGoCache) AddHit

func (c *HitGoCache) AddHit(hit string) error

AddHit updates the cache with a URL value

func (*HitGoCache) Clear

func (c *HitGoCache) Clear()

Clear empties the cache

func (*HitGoCache) HandleHit

func (c *HitGoCache) HandleHit(hit string)

HandleHit manages error handling in AddHit and runs in the worker

func (*HitGoCache) Items

func (c *HitGoCache) Items() map[string]int

Items returns a mapping of hits to integer counts

func (*HitGoCache) OnCron

func (c *HitGoCache) OnCron()

OnCron saves the cache to disk

Jump to

Keyboard shortcuts

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