cache

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedData

type CachedData[T EnkaCacheAble] struct {
	// contains filtered or unexported fields
}

func NewCachedData

func NewCachedData[T EnkaCacheAble](data T) CachedData[T]

func (*CachedData[T]) GetData

func (c *CachedData[T]) GetData() T

func (*CachedData[T]) IsExpired

func (c *CachedData[T]) IsExpired() bool

type EnkaCacheAble

type EnkaCacheAble interface {
	GetTtl() int
}

type EnkaHttpCache added in v0.4.0

type EnkaHttpCache interface {
	AddGenshinUser(*genshin.RawGenshinUser)
	GetGenshinUser(string) *genshin.RawGenshinUser

	AddHonkaiUser(*starrail.RawHonkaiUser)
	GetHonkaiUser(string) *starrail.RawHonkaiUser
}

func Default added in v0.2.3

func Default(log *slog.Logger) EnkaHttpCache

func ExternalCacheWrapper added in v0.4.0

func ExternalCacheWrapper(ext ExternalCache, log *slog.Logger) EnkaHttpCache

type ExternalCache added in v0.4.0

type ExternalCache interface {
	Save(key string, data []byte) error
	Load(key string) ([]byte, error)
}

Jump to

Keyboard shortcuts

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