mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-26 17:24:23 -04:00
Cache service data retention in Redis
Adds caching for service data retention. This removes separate API client methods to retrieve individual data retention records by id or type in favor of a single method that fetches and caches all retention settings configured for the service. This makes it much easier to invalidate cache when settings change. Lookup by id or type is provided by helper methods in the service model.
This commit is contained in:
@@ -268,7 +268,16 @@ class Service():
|
||||
return service_api_client.get_service_data_retention(self.id)
|
||||
|
||||
def get_data_retention_item(self, id):
|
||||
return service_api_client.get_service_data_retention_by_id(self.id, id)
|
||||
return next(
|
||||
(dr for dr in self.data_retention if dr['id'] == id),
|
||||
None
|
||||
)
|
||||
|
||||
def get_data_retention_by_type(self, notification_type):
|
||||
return next(
|
||||
(dr for dr in self.data_retention if dr['notification_type'] == notification_type),
|
||||
{}
|
||||
)
|
||||
|
||||
@property
|
||||
def email_branding_id(self):
|
||||
|
||||
Reference in New Issue
Block a user