app

package
v0.0.0-...-31a1c6c Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const CACHE_TIMEOUT = 20 * time.Second
View Source
const MAX_CACHE_SIZE_MB = 10

Do not store over this amount of MBs in the cache

Variables

This section is empty.

Functions

func SetupRoutes

func SetupRoutes(app_settings common.AppSettings, database database.Database) *gin.Engine

Types

type Cache

type Cache interface {
	Get(name string) (EndpointCache, error)
	Store(name string, buffer []byte) error
	Size() uint64
}

func MakeCache

func MakeCache(n_shards int, expiry_duration time.Duration, validator CacheValidator) Cache

type CacheValidator

type CacheValidator interface {
	IsValid(cache *EndpointCache) bool
}

type EndpointCache

type EndpointCache struct {
	Name       string
	Contents   []byte
	ValidUntil time.Time
}

type Generator

type Generator = func(*gin.Context, common.AppSettings, database.Database) ([]byte, error)

type TimeValidator

type TimeValidator struct{}

func (*TimeValidator) IsValid

func (validator *TimeValidator) IsValid(cache *EndpointCache) bool

type TimedCache

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

func (*TimedCache) Get

func (cache *TimedCache) Get(name string) (EndpointCache, error)

func (*TimedCache) Size

func (cache *TimedCache) Size() uint64

func (*TimedCache) Store

func (cache *TimedCache) Store(name string, buffer []byte) error

Jump to

Keyboard shortcuts

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