Implement general purpose cache_key function

This includes the non-instance logic from instance_cache_key. In addition
a warning is emitted for types that do not implement the __getstate__ method
for pickling.

Fix #258

Signed-off-by: Byron Ruth <b@devel.io>
Merge pull request #259 from cbmi/issue-258

Implement general purpose cache_key function