memory

package
v1.3.11 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package memory ...

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