Solution (source code)

= Solution

Conditioning on a <cache hit> or <cache miss>, the <expected latency> is
$$
\boxed{T(h)=h\cdot1+(1-h)\cdot45=45-44h\text{ ms},\qquad0\leq h\leq1.}
$$
This is a straight line from $(0,45)$ to $(1,1)$; at hit rate $1/2$, the mean is 23 ms. The 45 ms is already the complete miss-service time in the question, so another cache-lookup millisecond is not added to it.

\Image[/past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2016/digital-resit-cache-latency.png]
{title=Mean service time as a function of <cache hit rate>}
{description=Original plot of $T(h)=45-44h$ milliseconds, including the endpoint and midpoint values.}