Caching Algorithms for Similarity Search