cache

package
v0.0.0-...-bb55b62 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

自动缓存

数据缓存

分页缓存

分页缓存

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoCall

func AutoCall(mode Mode, f DataHandlerFunc, data any, args ...any) (err error)

自动缓存调用

func DataCall

func DataCall(mode Mode, f DataHandlerFunc, data any, args ...any) (err error)

数据缓存调用

func Key

func Key(mark *string) string

缓存标识

func PageCall

func PageCall(mode Mode, f PageHandlerFunc, subKey string, data any, page *Page, args ...any) (err error)

分页缓存调用

func PagesCall

func PagesCall(mode Mode, f PagesHandlerFunc, data any, page *Page, args ...any) (err error)

分页缓存调用

Types

type DataHandlerFunc

type DataHandlerFunc func(mode Mode, args ...any) *Result

缓存函数类型

type Mode

type Mode uint8
const (
	INIT Mode = iota
	READ
	DELETE
	SET
)

操作方式

type Page

type Page struct {
	Number int
	Limit  int
}

分页参数

type PageHandlerFunc

type PageHandlerFunc func(mode Mode, subKey string, page *Page, args ...any) *Result

分页缓存函数类型

type PagesHandlerFunc

type PagesHandlerFunc func(mode Mode, page *Page, args ...any) *Result

type Result

type Result struct {
	Data   any
	Key    string
	Expire uint32
	// Close  bool
	Redis redis.Redis
	Error error
}

缓存结果

Jump to

Keyboard shortcuts

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