Implement context caching

This branch implements a request-specific context cache for unique field and primary key lookups. It's a bit naive at the moment, and the cache is wiped at the beginning and the end of transactions.

@adamalton , could you give this a good review? Behaviour should follow that described by https://developers.google.com/appengine/docs/python/ndb/cache but extended to unique constraints.

In future the cache could be made a stack, and entering a transaction would push the stack, and leaving would pop it, or apply it to the lower stack entry. But wiping should be enough for now, just not as efficient as it could be.

Sorry the commits aren't as clean as they could be... it's all a bit messy :(