writebehind

Paddy 2015-03-31

0:85f9751b15ea Go to Latest

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.

History
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/doc.go	Tue Mar 31 23:09:02 2015 -0400
     1.3 @@ -0,0 +1,14 @@
     1.4 +/*
     1.5 +Package writebehind provides a cache that periodically syncs to a datastore.
     1.6 +
     1.7 +The Cache is really only useful for adding numbers that are expected to change
     1.8 +too frequently for a full datastore write, e.g. view counts.
     1.9 +
    1.10 +Each Cache can only be used once; calling its Stop() method renders the Cache
    1.11 +unusable, and a new Cache needs to be instantiated. Caches should, wherever
    1.12 +possible, have their Stop() methods called, or they risk leaking goroutines.
    1.13 +
    1.14 +Cache implements the expvar.Var type, and instances can be passed to
    1.15 +expvar.Publish to provide insight into the Cache while it's in operation.
    1.16 +*/
    1.17 +package writebehind