cieca

package module
v0.0.0-...-3d95e04 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2016 License: MIT Imports: 2 Imported by: 38

Documentation

Overview

Package cieca is an in-memory Key-Value datastore for Go. The main purpose is to easily cache data in the RAM for a certain amount of time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStore

type DataStore struct {
	// contains filtered or unexported fields
}

DataStore is the datastore containing all the data.

func (*DataStore) Clean

func (d *DataStore) Clean()

Clean clears the datastore. Not so thread-safe. Use with care.

func (*DataStore) Delete

func (d *DataStore) Delete(key string)

Delete removes an element from the datastore.

func (*DataStore) Expiration

func (d *DataStore) Expiration(key string) *time.Time

Expiration gets the time of expiration of a key.

func (*DataStore) Get

func (d *DataStore) Get(key string) []byte

Get retrieves a value in the datastore. If it is not found, nil is returned.

func (*DataStore) GetWithExist

func (d *DataStore) GetWithExist(key string) ([]byte, bool)

GetWithExist retrieves the value of a key, and a boolean indicating whether the value existed in the store.

func (*DataStore) Set

func (d *DataStore) Set(key string, value []byte)

Set sets a key in the datastore with no expiration.

func (*DataStore) SetWithExpiration

func (d *DataStore) SetWithExpiration(key string, value []byte, expiration time.Duration)

SetWithExpiration sets a key in the datastore with a certain value.

Jump to

Keyboard shortcuts

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