Efficient Temporal Reasoning in the Cached Event Calculus