Add cache support.

* Make it more testable and add basic tests.
* Add tox for testing in 2.6 and 2.7.
Seems like a questionable idea to use in memory caching depending on giving it a name or not.