cache

package
v0.0.0-...-46940d4 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetShortCodeScript string

Functions

This section is empty.

Types

type CInter

type CInter interface {
	// Count 短码池中的预生成短码数量
	Count(ctx context.Context) (int64, error)
	// GetShortCode 从短码池中获取一个预生成短码
	GetShortCode(ctx context.Context) (string, error)
	// InsertShortCode 向短码池中新增一条预生成短码
	InsertShortCode(ctx context.Context, code string) error
	// BatchInsertShortCodes 批量向短码池中增加多条预生成短码
	BatchInsertShortCodes(ctx context.Context, codes []string) error
}

func NewCache

func NewCache(client redis.Cmdable) CInter

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func (*Cache) BatchInsertShortCodes

func (c *Cache) BatchInsertShortCodes(ctx context.Context, codes []string) error

func (*Cache) Count

func (c *Cache) Count(ctx context.Context) (int64, error)

func (*Cache) GetShortCode

func (c *Cache) GetShortCode(ctx context.Context) (string, error)

GetShortCode 查询短码数量、获取一条可用的预生成短码、更新短码数量

func (*Cache) InsertShortCode

func (c *Cache) InsertShortCode(ctx context.Context, code string) error

Jump to

Keyboard shortcuts

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