Add size limit for in-memory cache
Allow configuring cache size via flags
Fix cache cleanup logic.

We weren't properly trimming keys from the keys array during background
cleanup.

This also adds more tests the new size-limited cache features.
Add internal cache metrics to expvars and graphite.