clear up sql caching code