split out cache struct and span an RWMutex around it
I've been doing too much ruby. Neither maps nor slices are thread safe
in golang. To prevent concurrent RW span a mutex over our cache to guard
the cache content. Performance impact seems negligible.
NB: golang got sync.Map a month ago which isn't yet released, might be
worth looking into to reduce boilerpalte a bit
NB2: this uses a QMutexLocker like approach by defering an unlock func
returned by convenience Locker/WLocker functions of the cache. This may be
a tad too smart for its own good while this is fairly fancy code it isn't
exactly obvious what the point of it is. Might get dropped in the future.