cache

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// For use with functions that take an expiration time.
	RememberForever time.Duration = -1

	DefaultExpiration = 5 * time.Minute
	DefaultCleanup    = 10 * time.Minute
)

Variables

View Source
var (
	Store *cache.Cache
)

Functions

func ClearCategoryCache

func ClearCategoryCache(categoryID int, posts domain.PostData)

func ClearPostCache

func ClearPostCache(id int)

func ClearUserCache

func ClearUserCache(userID int, posts domain.PostData)

func GetPostKey

func GetPostKey(id int) string

func Init

func Init()

Init set-ups go-cache with defaults

Types

type Cacher

type Cacher interface {
	Get(k string) (interface{}, bool)
	Set(k string, x interface{}, d time.Duration)
	Flush()
}

Jump to

Keyboard shortcuts

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