Skip to content

Commit

Permalink
refactor: Allow specifying default cache timeout as config value
Browse files Browse the repository at this point in the history
  • Loading branch information
jperras committed Oct 18, 2023
1 parent 1766caa commit 2d634a7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions flask_caching_s3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ def factory(
raise ValueError("You must specify CACHE_S3_BUCKET in your config.")

args.insert(0, config["CACHE_S3_BUCKET"])
key_prefix = config.get("CACHE_KEY_PREFIX")
if key_prefix:
if (key_prefix := config.get("CACHE_KEY_PREFIX")) is not None:
kwargs["key_prefix"] = key_prefix
if (default_timeout := config.get("CACHE_DEFAULT_TIMEOUT")) is not None:
kwargs["default_timeout"] = default_timeout
return cls(*args, **kwargs)

def _utcnow(self) -> datetime.datetime:
Expand Down

0 comments on commit 2d634a7

Please sign in to comment.