Add ability to not write cache from query result

Providing 0 as in the expiry argument of queryCache will result in not
cache being written. Resolves #2