Comments (5)
MVP. golang 1.18rc1
package main
import (
cache "github.com/Code-Hex/go-generics-cache"
"github.com/Code-Hex/go-generics-cache/policy/lru"
"math/rand"
"time"
)
var c *cache.Cache[int, int]
func main() {
c = cache.New(cache.AsLRU[int, int](lru.WithCapacity(10000)))
for i:= int64(0) ; i < 10 ; i++ {
go func(i int64) {
m := rand.New(rand.NewSource(i))
for {
c.Set(m.Intn(100000), m.Intn(100000))
c.Get(m.Intn(100000))
}
}(i)
}
time.Sleep(time.Minute*10)
}
it usually fails for me in few minutes
from go-generics-cache.
@mr-tron Thanks for your reporting.
Do you have a minimal code that is reproduced the problem?
from go-generics-cache.
No. But i use only get and set functions in parallel threads.
I will try to reproduce later.
from go-generics-cache.
@mr-tron I see in parallel.
Thanks a lot!
I will try to reproduce later
from go-generics-cache.
@mr-tron Thanks! I fixed at #17
And I just published a new version now (v0.0.9)
from go-generics-cache.
Related Issues (10)
- Improved performance/memory usage for items with an expiry HOT 8
- Clock policy: Not show all the page with sequential access pattern HOT 1
- Can a read-write lock be used in the cache instead of a mutex? HOT 1
- fatal error: concurrent map read and map write HOT 1
- Panic when deleting expired items HOT 3
- LFU: Allow setting the frequency and update the heap HOT 2
- Panic when delete expired items. HOT 1
- Feature: Add save and load functions in cache HOT 6
- Len() method missing from common cache interface HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-generics-cache.