concurrent

package
v0.0.0-...-436d200 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: BSD-3-Clause Imports: 2 Imported by: 1

Documentation

Overview

Provides a few useful thread-safe data-structures

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheResult

type CacheResult struct {
	// Result value
	V interface{}
	// Indicates whether it exists in the cache or not
	Found bool
}

Represents value in cache and whether it exists or not

type LRUCache

type LRUCache interface {
	// Retrieves multiple items from the cache
	GetMultiple(keys []string) []CacheResult
	// Retrieves a single item from the cache and whether it exists
	Get(key string) (v interface{}, found bool)
	// Sets a single item in the cache
	Set(key string, v interface{})
	// Sets multiple items in the cache
	SetMultiple(keyValues map[string]interface{})
	// Deletes one or more keys
	Delete(keys ...string)
	// Clears the cache
	Clear()
	// Retrieves the maximum size of the cache
	MaxSize() int
}

A thread-safe version of LRUCache

func NewLRUCache

func NewLRUCache(size int) LRUCache

type Map

type Map interface {
	// Retrieves an item from the map an indicates whether it exists or not
	Get(key interface{}) (interface{}, bool)
	// Sets the value for a particular item in the map
	Set(key interface{}, value interface{})
	// Deletes an item from the map with the provided key
	Delete(key interface{})
	// Retrieves the size of the map
	Len() int
}

A thread-safe version of map

func NewMap

func NewMap() Map

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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