Fix memory cache not exactly obeying size limit.