memory

package
v0.0.0-...-81568eb Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Content    []byte
	Expiration int64
}

Item is a cached reference

func (Item) Expired

func (item Item) Expired() bool

Expired returns true if the item has expired.

type Storage

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

Storage mechanism for caching strings in memory

func NewStorage

func NewStorage() *Storage

NewStorage creates a new in memory storage

func (Storage) Get

func (s Storage) Get(key string) []byte

Get a cached content by key

func (Storage) Set

func (s Storage) Set(key string, content []byte, duration time.Duration)

Set a cached content by key

Jump to

Keyboard shortcuts

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