cache

package
v0.0.0-...-8122643 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 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 interface {
	Set(key string, value interface{}, ttlSeconds ...int) error
	Get(key string, value interface{}) (bool, error)
	Unset(key string) error
	GetUnset(key string, value interface{}) (bool, error)
	Touch(key string) error
	Keys() ([]string, error)
	Clear() error
}

type GenericCache

type GenericCache[T any] interface {
	Set(key string, value T, ttlSeconds ...int) error
	Get(key string, value *T) (bool, error)
	Unset(key string) error
	GetUnset(key string, value *T) (bool, error)
	Touch(key string) error
	Keys() ([]string, error)
	Clear() error
}

type Lock

type Lock interface {
	NotObtained() bool
	Release() error
}

func LockObject

func LockObject(locker Locker, keyPrefix string, objectId string, ttl int) (Lock, error)

type Locker

type Locker interface {
	Lock(key string, ttl time.Duration) (Lock, error)
}

type SerializedObjectCache

type SerializedObjectCache struct {
	Serializer   message.Serializer
	StringCoding utils.StringCoding
	// contains filtered or unexported fields
}

func New

func New(backend StringCache, serializer ...message.Serializer) *SerializedObjectCache

func (*SerializedObjectCache) Clear

func (c *SerializedObjectCache) Clear() error

func (*SerializedObjectCache) Get

func (c *SerializedObjectCache) Get(key string, obj interface{}) (bool, error)

func (*SerializedObjectCache) GetUnset

func (c *SerializedObjectCache) GetUnset(key string, obj interface{}) (bool, error)

func (*SerializedObjectCache) Keys

func (c *SerializedObjectCache) Keys() ([]string, error)

func (*SerializedObjectCache) Set

func (c *SerializedObjectCache) Set(key string, value interface{}, ttlSeconds ...int) error

func (*SerializedObjectCache) Touch

func (c *SerializedObjectCache) Touch(key string) error

func (*SerializedObjectCache) Unset

func (c *SerializedObjectCache) Unset(key string) error

type StringCache

type StringCache = GenericCache[string]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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