added memory_cache, fixed an error with unnecessary delete of terms from cache, added to_hash method in Result class