github.com/cristiangreco/go-collapser (go): Package collapser provides a function call deduplication utility.  In many real-world scenarios, under high load or traffic conditions, an application may end up with several goroutines making the very same - expensive - function call at the same time. A Collapser provides a lock mechanism that enables multiple identical requests to be processed as one single request: while the first goroutine is making progress, the rest will be blocked waiting for the collapsed function to complete, and then will receive the same result.  Consider a server application accessing a database. Running the query execution function within a Collapser will alleviate database load by reducing many simultaneous requests to a single access.
Keywords: go|golang