writebehind
2015-03-31
writebehind/doc.go
First pass implementation. Create our first implementation of this. Use a map of string=>int64 to store our values. The idea here is that users will create one cache for each metric they want to collect--each column that needs updating, in MySQL land. Release it under the MIT license, because why not? Very proud that the first commit carries 100% test coverage, no golint errors, no go vet errors, and has a benchmark.
1 /*
2 Package writebehind provides a cache that periodically syncs to a datastore.
4 The Cache is really only useful for adding numbers that are expected to change
5 too frequently for a full datastore write, e.g. view counts.
7 Each Cache can only be used once; calling its Stop() method renders the Cache
8 unusable, and a new Cache needs to be instantiated. Caches should, wherever
9 possible, have their Stop() methods called, or they risk leaking goroutines.
11 Cache implements the expvar.Var type, and instances can be passed to
12 expvar.Publish to provide insight into the Cache while it's in operation.
13 */
14 package writebehind