Skip to main content

Infrastructure

Last updated: 2 Mar 2021

Mapit Caches

Mapit uses Django’s in-built middleware to cache responses to memcached. Mapit instances use a shared memcached instance.

Clear the shared cache

  1. SSH onto a mapit instance

  2. Connect via Telnet to memcached instance:

   telnet mapit-memcached 11211
  1. Enter the following:
   flush_all

You may need to clear the cache after updating the Mapit database with new data. As each Mapit instance has it’s own database, make sure to clear the cache after you’ve updated all Mapit instances.

Limitations of caching

Currently Django will only caches responses from the /postcode endpoints and not /area. This is due to /area responses being streaming responses.

Bypassing the cache

Cache keys are based on the URI of the request, therefore you can avoid the cache by adding a unique query string. For example /postcode/sw71ne?nocache=<random>.