tidy up all of cache api to be consistent and sensible
fix tests
fix context->copied memory error
bring iterator/bin inline