cache

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheProvider

type CacheProvider interface {
	Set(ctx context.Context, key string, value any, ttl time.Duration) (setable bool)
	Get(ctx context.Context, key string, unmarshalTo any) (found bool)
	Del(ctx context.Context, key string) (deleted bool)
	Keys(ctx context.Context, pattern string) []string
	Unlink(ctx context.Context, keys ...string) bool
	Incr(ctx context.Context, key string) bool
	Decr(ctx context.Context, key string) bool

	Flush() error
}

func New

func New(store StoreAdapter) CacheProvider

type NetworkSerializable

type NetworkSerializable interface {
	Encode() []byte
	Decode([]byte) error
}

type StoreAdapter

type StoreAdapter interface {
	CacheAdapter()

	Set(ctx context.Context, key string, value string, ttl time.Duration) (setable bool)
	Get(ctx context.Context, key string) (val string, found bool)
	Del(ctx context.Context, key string) (deleted bool)
	Keys(ctx context.Context, pattern string) []string
	Unlink(ctx context.Context, keys ...string) bool
	Incr(ctx context.Context, key string) bool
	Decr(ctx context.Context, key string) bool

	Flush() error
}

Directories

Path Synopsis
adapters

Jump to

Keyboard shortcuts

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