use marshal and cache to cache the query result