utils

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GlobalTTLMap

type GlobalTTLMap struct {
	Cache *TTLMap
}

GlobalTTLMap is a cache shared between all the rules

func GetGlobalTTLMapInstance

func GetGlobalTTLMapInstance(gcdelay time.Duration) *GlobalTTLMap

GetGlobalTTLMapInstance returns the unique GlobalTTLMap (singleton)

type TTLMap

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

TTLMap is a cache with ttl

func NewTTLMap

func NewTTLMap(gcdelay time.Duration) (m *TTLMap)

NewTTLMap creates a TTLMap instance

func (*TTLMap) Get

func (m *TTLMap) Get(k string) (interface{}, bool)

Get returns the value of the associated key from the cache

func (*TTLMap) Len

func (m *TTLMap) Len() int

Len returns the number of cached keys

func (*TTLMap) Put

func (m *TTLMap) Put(k, v interface{}, ttl int64)

Put inserts a key => value pair in the cache

Jump to

Keyboard shortcuts

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