ttlmap

package
v0.8.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2015 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 0

README

Build Status Build Status

TtlMap

Redis-like Map with expiry times and maximum capacity


import "github.com/mailgun/ttlmap"

mh, _ := ttlmap.NewMap(20)
mh.Set("key1", "value", 20)
valI, exists := mh.Get("key2")
if exists {
   val := valI.(string)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TtlMap

type TtlMap struct {
	TimeProvider timetools.TimeProvider
	// contains filtered or unexported fields
}

func NewMap

func NewMap(capacity int) (*TtlMap, error)

func NewMapWithProvider

func NewMapWithProvider(capacity int, timeProvider timetools.TimeProvider) (*TtlMap, error)

func (*TtlMap) Get

func (m *TtlMap) Get(key string) (interface{}, bool)

func (*TtlMap) GetInt

func (m *TtlMap) GetInt(key string) (int, bool, error)

func (*TtlMap) Increment

func (m *TtlMap) Increment(key string, value int, ttlSeconds int) (int, error)

func (*TtlMap) Len

func (m *TtlMap) Len() int

func (*TtlMap) Set

func (m *TtlMap) Set(key string, value interface{}, ttlSeconds int) error

Jump to

Keyboard shortcuts

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