Limit call_histories to 1000 and add caching.