Make use of NDB caching. Fixes #605

Some DB calls still aren't optimized, but the ones driving the major pages are.