Fix caching bug in use of `paramName`

This commit fixes a bug whereby the `paramName` option wasn't being
used when retrieving cached query results. This manifested as queries
missing the cache when they shouldn't (because they were inserted on
`result[paramName]` but retrieved via `result.query`).

Change-Id: I30fac4cb1de45533d2373e1293e13362b13e76a8
Reviewed-on: https://gerrit.causes.com/19109
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Tony Wooster <tony.wooster@causes.com>