Cache template in redis

This commit is contained in:
Chris Hill-Scott
2020-06-12 15:17:27 +01:00
parent 6c27b80060
commit 5b884ee1a6
2 changed files with 4 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ from gds_metrics import GDSMetrics
from time import monotonic
from notifications_utils.clients.zendesk.zendesk_client import ZendeskClient
from notifications_utils.clients.statsd.statsd_client import StatsdClient
from notifications_utils.clients.redis import RequestCache
from notifications_utils.clients.redis.redis_client import RedisClient
from notifications_utils.clients.encryption.encryption_client import Encryption
from notifications_utils import logging, request_helper
@@ -55,6 +56,7 @@ encryption = Encryption()
zendesk_client = ZendeskClient()
statsd_client = StatsdClient()
redis_store = RedisClient()
request_cache = RequestCache(redis_store)
performance_platform_client = PerformancePlatformClient()
document_download_client = DocumentDownloadClient()
metrics = GDSMetrics()

View File

@@ -16,7 +16,7 @@ from app.models import (
)
from app.service.utils import service_allowed_to_send_to
from app.v2.errors import TooManyRequestsError, BadRequestError, RateLimitError
from app import redis_store
from app import redis_store, request_cache
from app.notifications.process_notifications import create_content_for_notification
from app.utils import get_public_notify_type_text
from app.dao.service_email_reply_to_dao import dao_get_reply_to_by_id
@@ -138,6 +138,7 @@ def check_notification_content_is_not_empty(template_with_content):
raise BadRequestError(message=message)
@request_cache.set('template-{template_id}-version-None')
def get_template_dict(template_id, service_id):
from app.schemas import template_schema
try: