optimize cache searching