timedmap alternatives and similar packages
Based on the "Data Structures" category.
Alternatively, view timedmap alternatives based on common mentions on social networks and blogs.
-
gods
GoDS (Go Data Structures) - Sets, Lists, Stacks, Maps, Trees, Queues, and much more -
go-datastructures
A collection of useful, performant, and threadsafe Go datastructures. -
golang-set
A simple, battle-tested and generic set type for the Go language. Trusted by Docker, 1Password, Ethereum and Hashicorp. -
gocache
☔️ A complete Go cache library that brings you multiple ways of managing your caches -
boomfilters
Probabilistic data structures for processing continuous, unbounded streams. -
gostl
Data structure and algorithm library for go, designed to provide functions similar to C++ STL -
hyperloglog
HyperLogLog with lots of sugar (Sparse, LogLog-Beta bias correction and TailCut space reduction) brought to you by Axiom -
trie
Data structure and relevant algorithms for extremely fast prefix/fuzzy string searching. -
go-geoindex
Go native library for fast point tracking and K-Nearest queries -
ttlcache
An in-memory cache with item expiration and generics [Moved to: https://github.com/jellydator/ttlcache] -
Bloomfilter
Face-meltingly fast, thread-safe, marshalable, unionable, probability- and optimal-size-calculating Bloom filter in go -
hilbert
Go package for mapping values to and from space-filling curves, such as Hilbert and Peano curves. -
go-adaptive-radix-tree
Adaptive Radix Trees implemented in Go -
goconcurrentqueue
Go concurrent-safe, goroutine-safe, thread-safe queue -
cuckoo-filter
Cuckoo Filter go implement, better than Bloom Filter, configurable and space optimized 布谷鸟过滤器的Go实现,优于布隆过滤器,可以定制化过滤器参数,并进行了空间优化 -
ring
Package ring provides a high performance and thread safe Go implementation of a bloom filter. -
go-rquad
:pushpin: State of the art point location and neighbour finding algorithms for region quadtrees, in Go -
set
A simple Set data structure implementation in Go (Golang) using LinkedHashMap. -
nan
Zero allocation Nullable structures in one library with handy conversion functions, marshallers and unmarshallers -
goset
Set is a useful collection but there is no built-in implementation in Go lang. -
hide
ID type with marshalling to/from hash to prevent sending IDs to clients.
ONLYOFFICE Docs — document collaboration in your environment
Do you think we are missing an alternative of timedmap or a related project?
README
~ timedmap ~ A map which has expiring key-value pairs.
go get -u github.com/zekroTJA/timedmap
Intro
This package allows to set values to a map which will expire and disappear after a specified time.
Here you can read the docs of this package, generated by pkg.go.dev.
Usage Example
package main
import (
"log"
"time"
"github.com/zekroTJA/timedmap"
)
func main() {
// Create a timed map with a cleanup timer interval of 1 second
tm := timedmap.New(1 * time.Second)
// Set value of key "hey" to 213, which will expire after 3 seconds
tm.Set("hey", 213, 3*time.Second)
// Print the value of "hey"
printKeyVal(tm, "hey")
// Block the main thread for 5 seconds
// After this time, the key-value pair "hey": 213 has expired
time.Sleep(5 * time.Second)
// Now, this function should show that there is no key "hey"
// in the map, because it has been expired
printKeyVal(tm, "hey")
}
func printKeyVal(tm *timedmap.TimedMap, key interface{}) {
d, ok := tm.GetValue(key).(int)
if !ok {
log.Println("data expired")
return
}
log.Printf("%v = %d\n", key, d)
}
Further examples, you can find in the [example](examples) directory.
If you want to see this package in a practcal use case scenario, please take a look at the rate limiter implementation of the REST API of myrunes.com, where I have used timedmap
for storing client-based limiter instances:
https://github.com/myrunes/backend/blob/master/internal/ratelimit/ratelimit.go
Copyright (c) 2020 zekro Development (Ringo Hoffmann).
Covered by MIT licence.