finish the search cache function