cache

package
v1.4.2-7 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 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 Config

type Config struct {
	Enabled     bool       `mapstructure:"enabled"`
	Time        int        `mapstructure:"time"`
	StoragePath string     `mapstructure:"storagepath"`
	SufixFile   string     `mapstructure:"sufixfile"`
	Endpoints   []Endpoint `mapstructure:"endpoints"`
}

Config structure for storing cache system configuration

func (*Config) BuntConnect

func (c *Config) BuntConnect(key string) (db *buntdb.DB, err error)

BuntConnect connects to database BuntDB - used for caching

func (Config) BuntGet

func (c Config) BuntGet(key string, w http.ResponseWriter) (cacheExist bool)

BuntGet downloads the data - if any - that is in the buntdb (embedded cache database) using response.URL.String() as key

func (Config) BuntSet

func (c Config) BuntSet(key, value string)

BuntSet sets data as cache in buntdb (embedded cache database) using response.URL.String() as key

func (*Config) ClearEndpoints

func (c *Config) ClearEndpoints()

func (Config) EndpointRules

func (c Config) EndpointRules(uri string) (bool, int)

EndpointRules checks if there is a custom caching rule for the endpoint

type Endpoint

type Endpoint struct {
	Enabled  bool   `mapstructure:"enabled"`
	Endpoint string `mapstructure:"endpoint"`
	Time     int    `mapstructure:"time"`
}

Endpoint specific configuration for specific endpoint

Jump to

Keyboard shortcuts

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