cache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: MIT Imports: 1 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 map[string]string)
	Get(key string) (map[string]string, bool)
	Len() int
}

Cache is an interface for cache that stores parsed user agents

type LRUCache

type LRUCache struct {
	*lru.Cache
}

LRUCache is the wrapper of lru cache implementation from hashicorp for storing parsed user agents

func NewLRUCache

func NewLRUCache(size int) (*LRUCache, error)

NewLRUCache creates new wrapper for storing parsed user agents

func (*LRUCache) Get

func (c *LRUCache) Get(key string) (map[string]string, bool)

Get returns value by key if such key exists in cache

func (*LRUCache) Len

func (c *LRUCache) Len() int

Len returns cache length

func (*LRUCache) Set

func (c *LRUCache) Set(key string, value map[string]string)

Set sets value under key to cache

Jump to

Keyboard shortcuts

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