cache

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 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 added in v1.4.2

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 added in v1.4.2

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

BuntConnect connects to database BuntDB - used for caching

func (Config) BuntGet added in v1.4.2

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 added in v1.4.2

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 added in v1.4.2

func (c *Config) ClearEndpoints()

func (Config) EndpointRules added in v1.4.2

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

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

type Endpoint added in v1.4.2

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