svc

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Inject added in v1.0.10

func Inject[T any](p do.Provider[T])

注入

func Use added in v1.0.0

func Use[T any]() T

使用

Types

type CacheSvc added in v1.0.17

type CacheSvc struct {
	Local *cache.Cache  // 本地
	Redis *redis.Client // 远程
}

缓存服务

func NewCacheSvc added in v1.0.17

func NewCacheSvc(i *do.Injector) (*CacheSvc, error)

构造函数

func (*CacheSvc) ListCaches added in v1.0.17

func (s *CacheSvc) ListCaches(typ string, keyword string) ([]mdl.Cache, int64, error)

列举缓存集合

func (*CacheSvc) RemoveCaches added in v1.0.17

func (s *CacheSvc) RemoveCaches(typ string, keys []string) error

移除缓存集合

type Svc

type Svc[M any] struct {
	*CacheSvc
	*dao.Dao[M]
	Prefix string // 前缀
}

服务

func NewSvc

func NewSvc[M any](prefix string) *Svc[M]

构造函数

func (*Svc[M]) GetFullKey added in v1.0.21

func (s *Svc[M]) GetFullKey(keys ...any) string

获取完整键

func (*Svc[M]) GetLocal added in v1.0.17

func (s *Svc[M]) GetLocal(expiration time.Duration, conds ...any) (*M, error)

获取本地

func (*Svc[M]) GetRedis added in v1.0.3

func (s *Svc[M]) GetRedis(expiration time.Duration, conds ...any) (*M, error)

获取远程

func (*Svc[M]) ListLocal added in v1.0.17

func (s *Svc[M]) ListLocal(expiration time.Duration, conds ...any) ([]M, error)

列举本地

func (*Svc[M]) ListRedis added in v1.0.17

func (s *Svc[M]) ListRedis(expiration time.Duration, conds ...any) ([]M, error)

列举远程

Jump to

Keyboard shortcuts

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