cache

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 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 MemCache

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

MemCache defines a lightweight in-memory cache that is thread safe

func New

func New() *MemCache

New will generate an return a new empty in-memory cache

func (*MemCache) Get

func (c *MemCache) Get(key string) (string, bool)

Get returns an item from the cache using the given cache key. A flag is also returned indicating whether the item exists. If no item exists, an empty string will be returned

func (*MemCache) Remove

func (c *MemCache) Remove(keys ...string)

Remove an item from the cache using the given cache key. Nothing will happen if no item exists

func (*MemCache) Set

func (c *MemCache) Set(key string, value string)

Set a value within the cache using the given cache key. If the value already exists, it will be overwritten

Jump to

Keyboard shortcuts

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