memcached

package
v0.0.0-...-34cbb95 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package memcached implements cache.Cache via memcached.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache implements the cache.Cache interface.

func New

func New(servers []string, namespace string) (*Cache, error)

New returns a new in-memory cache of the given size.

The namespace is the string to add to each key to avoid conflicts with more than one application or application instance using the same memcached server.

Memcached can spread cache values across multiple servers, which is why 'servers' is a string slice of addresses of the form "dns_name:port".

func (*Cache) Add

func (c *Cache) Add(key string)

Add implements the cache.Cache interface.

func (*Cache) Exists

func (c *Cache) Exists(key string) bool

Exists implements the cache.Cache interface.

func (*Cache) GetValue

func (c *Cache) GetValue(ctx context.Context, key string) (string, error)

func (*Cache) SetValue

func (c *Cache) SetValue(ctx context.Context, key string, value string) error

Jump to

Keyboard shortcuts

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