compressedcache

package module
v0.0.0-...-6c626af Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: MIT Imports: 4 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 comparable, V any] interface {

	// Get get cache data by key
	Get(k K) (V, bool)

	// Set set new cache data
	Set(k K, v V) bool

	// Remove remove the specified key
	Del(k K)

	SetWithTTL(k K, v V, ttl time.Duration) bool
	GetTTL(k K) (time.Duration, bool)
	Close()
}

func NewCompressedCache

func NewCompressedCache[K comparable, V any](
	comp compress.Compressor,
	serialize func(any) ([]byte, error),
	deserialize func([]byte) (any, error),
) (Cache[K, V], error)

type CompressedCache

type CompressedCache[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func (*CompressedCache[K, V]) Close

func (ch *CompressedCache[K, V]) Close()

func (*CompressedCache[K, V]) Del

func (ch *CompressedCache[K, V]) Del(k K)

func (*CompressedCache[K, V]) Get

func (ch *CompressedCache[K, V]) Get(k K) (V, bool)

func (*CompressedCache[K, V]) GetTTL

func (ch *CompressedCache[K, V]) GetTTL(k K) (time.Duration, bool)

func (*CompressedCache[K, V]) Set

func (ch *CompressedCache[K, V]) Set(k K, v V) bool

func (*CompressedCache[K, V]) SetWithTTL

func (ch *CompressedCache[K, V]) SetWithTTL(k K, v V, ttl time.Duration) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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