metadata

package
v0.0.0-...-f4bd7b1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2015 License: Apache-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package metadata implements in memory caching methods for metadata information

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// Mutex is used for handling the concurrent
	// read/write requests for cache
	sync.Mutex
	// contains filtered or unexported fields
}

Cache holds the required variables to compose an in memory cache system which also provides expiring key mechanism and also maxSize

func NewCache

func NewCache() *Cache

NewCache creates an inmemory cache

func (*Cache) Delete

func (r *Cache) Delete(key string)

Delete deletes a given key if exists

func (*Cache) Exists

func (r *Cache) Exists(key string) bool

Exists returns true if key exists

func (*Cache) Get

func (r *Cache) Get(key string) interface{}

Get returns a value of a given key if it exists

func (*Cache) GetAll

func (r *Cache) GetAll() map[string]interface{}

GetAll returs all the items

func (*Cache) Set

func (r *Cache) Set(key string, value interface{}) bool

Set will persist a value to the cache

func (*Cache) Stats

func (r *Cache) Stats() Stats

Stats get current cache statistics

type Stats

type Stats struct {
	Items int
}

Stats current cache statistics

Jump to

Keyboard shortcuts

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