cache

package
v0.0.0-...-6677412 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const AppPrefix = "dega:"

Variables

This section is empty.

Functions

func CachingMiddleware

func CachingMiddleware() func(http.Handler) http.Handler

func IsEnabled

func IsEnabled() bool

func RespMiddleware

func RespMiddleware(next http.Handler) http.Handler

func SaveToCache

func SaveToCache(ctx context.Context, queryStr string, data interface{}) error

func SetupCache

func SetupCache(redisAddress string, password string, ttl time.Duration, db int) error

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}
var GlobalCache *Cache

GlobalCache: global cache

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, key string) ([]byte, error)

func (*Cache) Set

func (c *Cache) Set(ctx context.Context, key string, value interface{}) error

type CacheResponseWriter

type CacheResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func (*CacheResponseWriter) Write

func (myrw *CacheResponseWriter) Write(p []byte) (int, error)

Here we are implementing a Write() function from ResponseWriter with our custom instructions.

func (*CacheResponseWriter) WriteHeader

func (myrw *CacheResponseWriter) WriteHeader(header int)

Jump to

Keyboard shortcuts

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