Remove cache limit functionality.

This was buggy and is unnecessary for now.
reduce: Make return on failure a bit more sensible.
Inline all SQL queries.

Composing these queries out of line wasn't gaining us much and created a level
of indirection that was difficult to work with.

Closes #2