Skip to content

Instantly share code, notes, and snippets.

View Odiumediae's full-sized avatar
🐢
Mostly active on GitLab. I may be slow to respond.

Daniel Stopp Odiumediae

🐢
Mostly active on GitLab. I may be slow to respond.
View GitHub Profile
@alexedwards
alexedwards / cache.go
Last active April 10, 2024 00:53
Generic in-memory cache implementation in Go
package cache
import (
"sync"
"time"
)
// Cache is a basic in-memory key-value cache implementation.
type Cache[K comparable, V any] struct {
items map[K]V // The map storing key-value pairs.