encryptio / go-meetup Goto Github PK
View Code? Open in Web Editor NEWSmart Meetup Cache for Go programs
License: MIT License
Smart Meetup Cache for Go programs
License: MIT License
This is needed for fully linearizable caches; the idea being that you can cache data, but do a less expensive validation step at each get to make sure the data is up to date. Once you know that, you can either re-get it from the backend or return it as-is.
This would be intended for use by a background cleaner goroutine (managed outside of go-meetup itself) to reduce memory usage for caches that are not near their size limits.
For example, this code:
c := meetup.New(meetup.Options{
ExpireAge: time.Minute,
})
var i int64
for i := int64(0); ; i++ {
c.Get(strconv.Itoa(i))
time.Sleep(time.Second)
}
Will use an unbounded amount of memory.
Extension of #1
If we know we're going to block on readiness (!e.Ready
) and we call c.startFill(key, e)
, we should instead directly call fill
to avoid the overhead of starting a goroutine.
The concurrency limiter chooses the next request to run psuedorandomly, due to the use of a channel write to implement concurrency limiting.
This behavior can stall individual reads for an arbitrary amount of time, adding a large variation in latency for requests.
Instead of writing to a full channel, something with fairer semantics should be implemented; for example, a deque.
entry
values can have their memory reused once they are not in use by any Get
and are not in the tree (have been evicted or expired.)
Currently, eviction in (*Cache).fill
iterates over all entries and removes ones that have not been recently used (since the last eviction pass hit those pairs.)
If fill
checked for expired values as it iterated and removed those, regardless of whether they had been recently used or not, then it would need the same or fewer iterations to free space for values, only remove values which cannot be used anyway, and thus make better use of the cache space.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.