internal

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Load(ctx context.Context, key string) string
	Set(ctx context.Context, key string, data string, timeout time.Duration)
	DoEvict(ctx context.Context, keys []string)
}

type CacheHandler

type CacheHandler struct {
	Cache      Cache
	OnCacheHit CacheHitHook // 命中缓存钩子 优先级低
}

func New

func New(c Cache, onCacheHit ...func(c *gin.Context, cacheValue string)) *CacheHandler

func (*CacheHandler) DoEvict

func (cache *CacheHandler) DoEvict(ctx context.Context, keys []string)

func (*CacheHandler) Handler

func (cache *CacheHandler) Handler(caching Caching, next gin.HandlerFunc) gin.HandlerFunc

Handler for startup

func (*CacheHandler) Load

func (cache *CacheHandler) Load(ctx context.Context, key string) string

func (*CacheHandler) Set

func (cache *CacheHandler) Set(ctx context.Context, key string, data string, timeout time.Duration)

Directories

Path Synopsis
drivers

Jump to

Keyboard shortcuts

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