Cache returned letter summary in Redis

We’re going to start using the returned letters summary to show some
info on the dashboard.

This means we will be accessing it more often than it changes. And we
know exactly when it changes because it’s us manually submitting the
references we get from DVLA.

This makes it a good candidate for being cached, and Redis is where we
cache stuff that we’d otherwise go to the API for.
This commit is contained in:
Chris Hill-Scott
2020-02-12 11:42:06 +00:00
parent 4d7a41d55d
commit af8395956e
4 changed files with 27 additions and 1 deletions

View File

@@ -569,6 +569,7 @@ class ServiceAPIClient(NotifyAdminAPIClient):
def get_service_data_retention(self, service_id):
return self.get("/service/{}/data-retention".format(service_id))
@cache.set('service-{service_id}-returned-letters-summary')
def get_returned_letter_summary(self, service_id):
return self.get("service/{}/returned-letter-summary".format(service_id))