memcached

package
v0.10.14 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cache

func Cache[T any]() types.Cache[T]

func Client

func Client() (*memcache.Client, error)

Client returns the Memcached client instance

func Close

func Close()

Close closes the Memcached client connection Note: gomemcache doesn't have a Close method, but we keep this for API consistency

func Decrement

func Decrement(key string, delta uint64) (uint64, error)

Decrement decrements a counter by delta

func Delete

func Delete(key string) error

Delete removes a key-value pair

func Get

func Get(key string) ([]byte, error)

Get retrieves a value by key

func GetMulti

func GetMulti(keys []string) (map[string]*memcache.Item, error)

GetMulti retrieves multiple values by keys

func Health

func Health() error

Health checks if the Memcached connection is healthy

func Increment

func Increment(key string, delta uint64) (uint64, error)

Increment increments a counter by delta

func Init

func Init() (err error)

Init initializes the global Memcached client. It reads Memcached configuration from config.App.Memcached. If Memcached is not enabled, it returns nil. The function is thread-safe and ensures the client is initialized only once.

func New

func New(cfg config.Memcached) (*memcache.Client, error)

New returns a new Memcached client instance with given configuration. It's the caller's responsibility to close the client if needed.

func Set

func Set(key string, value []byte, expiration int32) error

Set stores a key-value pair with expiration time

Types

This section is empty.

Jump to

Keyboard shortcuts

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