kvc

package
v0.0.0-...-8bebc79 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2016 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KVC

type KVC interface {
	Get(Key) Value
	Has(Key) bool
	Set(Key, Value)
	SetTTL(Key, Value, time.Duration)
	GetAndSet(Key, func(Value) Value)
	CompareAndSet(Key, Value, func() bool) bool
}

func NewMem

func NewMem() KVC

type Key

type Key interface{}

type MemKVC

type MemKVC struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*MemKVC) CompareAndSet

func (c *MemKVC) CompareAndSet(k Key, v Value, cmp func() bool) bool

CompareAndSet sets the value if the cmp function returns true Only Unsafe* method's should be used in the cmp func since they do not acquire locks

func (*MemKVC) Get

func (c *MemKVC) Get(k Key) Value

func (*MemKVC) GetAndSet

func (c *MemKVC) GetAndSet(k Key, fn func(cur Value) Value)

func (*MemKVC) Has

func (c *MemKVC) Has(k Key) bool

func (*MemKVC) Set

func (c *MemKVC) Set(k Key, v Value)

func (*MemKVC) SetTTL

func (c *MemKVC) SetTTL(k Key, v Value, ttl time.Duration)

func (*MemKVC) UnsafeGet

func (m *MemKVC) UnsafeGet(k Key) Value

func (*MemKVC) UnsafeHas

func (m *MemKVC) UnsafeHas(k Key) bool

func (*MemKVC) UnsafeSet

func (m *MemKVC) UnsafeSet(k Key, v Value)

type Value

type Value interface{}

Jump to

Keyboard shortcuts

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