cache

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: AGPL-3.0 Imports: 8 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[K string, V any] struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache[K string, V any](ttl time.Duration) *Cache[K, V]

func (*Cache[K, V]) ComputeIfAbsent

func (c *Cache[K, V]) ComputeIfAbsent(key K, f func() (V, error)) (*V, error)

func (*Cache[K, V]) Delete

func (c *Cache[K, V]) Delete(key K)

func (*Cache[K, V]) EvictAll

func (c *Cache[K, V]) EvictAll()

func (*Cache[K, V]) Get

func (c *Cache[K, V]) Get(key K) (V, bool)

func (*Cache[K, V]) SetWithTTL

func (c *Cache[K, V]) SetWithTTL(key K, value V, ttl time.Duration) bool

type VersionCacheGroup

type VersionCacheGroup struct {
	VersionLatestCache         *Cache[string, *ent.Version]
	VersionNameCache           *Cache[string, *ent.Version]
	IncrementalUpdatePathCache *Cache[string, string]
	FullUpdatePathCache        *Cache[string, string]
}

func NewVersionCacheGroup

func NewVersionCacheGroup(rdb *redis.Client) *VersionCacheGroup

func (*VersionCacheGroup) EvictAll

func (g *VersionCacheGroup) EvictAll()

func (*VersionCacheGroup) GetCacheKey

func (g *VersionCacheGroup) GetCacheKey(elems ...string) string

Jump to

Keyboard shortcuts

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