google/cayley — pull request #180 by bkendall (2014-11-02 00:36:40+00:00)
Title: Prevent empty values in cache (using mongo)

(This is a second PR for a subset of a previous PR that failed on travis because of the mongo versions - see below).

This PR prevents empty values from nodes that are not found from being added to the cache when the mongo backend is used. I was seeing almost exactly what issue #130 was describing and decided to sit down and debug my way through it. Removing the cache logic from the NameOf function pointed me in the right direction. The logic previously was adding to the cache even if the node was not found, which was then providing the empty strings I was seeing during the queries. It will now prevent a not found node from being added to the cache.

I tested these locally against mongo version `2.6.5` and the tests passed (`go test -v -backend=mongo ./...`)! My previous PR (#179) has the commit for adding them to travis, but since travis uses `2.4.x`, the tests failed (and I verified that they failed locally with a `2.4.x` mongo as well).

I have signed the CLA, as requested.