Issue #301: Fix DB Query tests.
Issue #289: Added cache helper functions.
Issue #289: Added tests to the helper functions.