fcache

package module
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

package fcache provides caching middleware for the Fiber web framework. The caching engine can be accessed through the Cache variable.

Index

Constants

View Source
const (
	AutoGenerateKey = ""
	NoExpiration    = gc.NoExpiration
)

Variables

View Source
var (
	Cache  *gc.Cache
	Config internalConfig
)

Functions

func New

func New() func(*fiber.Ctx) error

New returns a new instance of the caching middleware, with an automatically generated key and the default TTL.

func NewWithKey

func NewWithKey(key string) func(*fiber.Ctx) error

NewWithKey returns a new instance of the caching middleware with the default TTL and the option to set your own cache key. If this is an empty string or AutoGenerateKey, a key will be automatically generated.

func NewWithTTL

func NewWithTTL(key string, ttl time.Duration) func(*fiber.Ctx) error

NewWithTTL returns a new instance of the caching middleware with the option to define your own cache key and your own TTL. If the cache key you set is an empty string or AutoGenerateKey, a key will be automatically generated.

Types

type CacheEntry

type CacheEntry struct {
	Body        []byte
	StatusCode  int
	ContentType []byte
}

Jump to

Keyboard shortcuts

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