Skip to content

Commit

Permalink
update docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvin-muchiri committed Sep 2, 2024
1 parent f3e6b7f commit d031b18
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion onadata/apps/api/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,15 @@ def invalidate_organization_cache(org_username):


def get_xform_list_cache_key(user, xform_or_project):
"""Get the cache key for the XForm list by user role"""
"""Get the cache key for the XForm list by user's role
Args:
user: User making request
xform_or_project: XForm or Project being accessed
Returns:
str: cache key based on role assigned to form/project
"""
object_type = type(xform_or_project).__name__
cache_key_prefix = f"{XFORM_LIST_CACHE}{xform_or_project.id}-{object_type}"
anonymous_user_key = f"{cache_key_prefix}-anon"
Expand Down
2 changes: 1 addition & 1 deletion onadata/libs/utils/cache_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
XFORM_REGENERATE_INSTANCE_JSON_TASK = "xfm-regenerate_instance_json_task-"
XFORM_MANIFEST_CACHE = "xfm-manifest-"
XFORM_LIST_CACHE = "xfm-list-"
XFROM_LIST_CACHE_TTL = 10 * 60
XFROM_LIST_CACHE_TTL = 10 * 60 # 10 minutes converted to seconds

# Cache timeouts used in XForm model
XFORM_REGENERATE_INSTANCE_JSON_TASK_TTL = 24 * 60 * 60 # 24 hrs converted to seconds
Expand Down

0 comments on commit d031b18

Please sign in to comment.