Signed up recently but had issues with the confirmation email?

Click Forgot password and follow the reset steps. You can choose the same password you used when you signed up. This should then provide access.

Remember to check Spam and Junk. The email will be from auth@progressbytes.co.uk.

Revision notesQuestionsFor schools
Revise Computing
Log inStart revising free
Revision notesQuestionsFor schoolsLog in

© 2026 Revise Computing · revisecomputing.co.uk

Worried about something?Question Bank UpdatesPrivacy noticeTermsContact

Revise Computing is an independent revision resource. It is not affiliated with, or endorsed by, OCR (Oxford Cambridge and RSA Examinations).

Knowledge/A Level/H446/02 Algorithms and programming/Thinking ahead/The nature, benefits and drawbacks of caching

The nature, benefits and drawbacks of caching

The nature, benefits and drawbacks of caching.

2.1.2 Thinking ahead

Practise exam questions

Thinking ahead — Note 3 of 4

Candidates need to understand the purpose of caching in programming and how it can be used when writing a program. Candidates need to be able to apply caching to a scenario and understand the benefits and drawbacks of using it.

What you need to know

Caching stores data that has been used recently, or is likely to be needed soon, in a location that is faster to access. It is an example of thinking ahead, used in processors, web browsers and programs.

What to know

  • Examples: processor cache; web browsers caching pages and images; DNS caching; a program storing the results of an expensive calculation (memoisation).
  • Prefetching: loading data into the cache BEFORE it is requested, based on a prediction of what will be needed.
  • Benefits: faster access when the requested data is already in the cache (a cache hit); less load on servers and networks; less bandwidth used.
  • Drawbacks: cached data can become out of date (stale); caches take up memory or storage; on a cache miss (the data is not in the cache) it comes from the slower source; a wrong prediction wastes time loading data that is never used; managing a cache adds complexity.

Code examples

Caching the results of a slow calculation (memoisation)
python
cache = {}

def slow_square(n):
    if n in cache:              # cache hit: return the stored result
        return cache[n]
    result = n * n              # imagine this takes a long time
    cache[n] = result           # store for next time
    return result

Key terms

Caching

Temporarily storing data or instructions that have been used, or are likely to be needed, so they can be accessed more quickly next time.

Exam technique

  • Mistake:Thinking caching only means the processor's cache memory. In a program, caching means keeping data already fetched or worked out (records, images, results) in a faster store such as RAM, so it need not be fetched or calculated again.
  • Tip:Apply caching to the scenario, e.g. 'the game could cache the map tiles around the player so they appear instantly as the player moves'. Say what would be stored and why it is likely to be needed again.
  • Tip:In an evaluation, judge how often the scenario's data will be requested again (the hit ratio), weigh the speed gain against stale data, memory used and extra design time, and finish with a recommendation.

Past exam questions

  • June 2022Paper 2Q4(b)2marks
  • June 2019Paper 2Q7(c)9marks
  • June 2018Paper 2Q6(c)9marks

Ready to test yourself?

Practise 2.1.2 questions
← Previous noteDetermine the preconditions for devising a solution to a problem2.1.2 Thinking aheadNext note →The need for reusable program components2.1.2 Thinking ahead

Back to Thinking ahead

Thinking ahead

Note 3 of 4

  1. 1Identify the inputs and outputs for a given situation
  2. 2Determine the preconditions for devising a solution to a problem
  3. 3The nature, benefits and drawbacks of caching
  4. 4The need for reusable program components
Topic overview