Skip to content

Commit

Permalink
New cache keys for email daily limit (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
jzbahrai authored Jul 19, 2023
1 parent a6648e9 commit c1da950
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions notifications_utils/clients/redis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,19 @@ def email_daily_count_cache_key(service_id) -> str:
"""
return "email-{}-{}-{}".format(str(service_id), datetime.utcnow().strftime("%Y-%m-%d"), "count")


def near_email_daily_limit_cache_key(service_id) -> str:
"""
Cache key that stores a str with the current date time indicating is the service is nearing the daily email limit.
"""
return f"nearing-daily-email-limit-{email_daily_count_cache_key(service_id)}"


def over_email_daily_limit_cache_key(service_id) -> str:
"""
Cache key that stores a str with the current date time indicating is the service is over the daily email limit.
"""
return f"over-daily-email-limit-{email_daily_count_cache_key(service_id)}"

0 comments on commit c1da950

Please sign in to comment.