add cache function on query service