-
Notifications
You must be signed in to change notification settings - Fork 74
Feature/key prefix propagation to redis core and global prefix override #395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
matteomorlack
wants to merge
10
commits into
python-cachier:master
Choose a base branch
from
matteomorlack:feature/key-prefix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ae5ccb0
feat: add global key prefixes
matteomorlack abb9f60
feat: add global key prefixes
matteomorlack 709b2a0
fix: annotation
matteomorlack cf8dac8
feat: add documentation
matteomorlack 2c7ce3b
feat: make global func prefix work with defaults
matteomorlack 9dec363
feat: add tests for redis
matteomorlack 2f758a8
revert: unrelated change to global func prefix
matteomorlack 73cb627
revert: unrelated change to global func prefix
matteomorlack 1e61bce
feat: add test for redis prefix set from global params
matteomorlack d1f7eba
feat: add test for redis prefix set from global params
matteomorlack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -226,6 +226,7 @@ def cachier( | |
| mongetter: Optional[Mongetter] = None, | ||
| sql_engine: Optional[Union[str, Any, Callable[[], Any]]] = None, | ||
| redis_client: Optional["RedisClient"] = None, | ||
| key_prefix: Optional[str] = None, | ||
| s3_bucket: Optional[str] = None, | ||
| s3_prefix: str = "cachier", | ||
| s3_client: Optional["S3Client"] = None, | ||
|
|
@@ -280,6 +281,8 @@ def cachier( | |
| redis_client : redis.Redis or callable, optional | ||
| Redis client instance or callable returning a Redis client. | ||
| Used for the Redis backend. | ||
| key_prefix : str, optional | ||
| Key prefix applied to all redis keys. Defaults to ``"cachier"``. | ||
| s3_bucket : str, optional | ||
| The S3 bucket name for cache storage. Required when using the S3 backend. | ||
| s3_prefix : str, optional | ||
|
|
@@ -357,6 +360,7 @@ def cachier( | |
| backend = _update_with_defaults(backend, "backend") | ||
| mongetter = _update_with_defaults(mongetter, "mongetter") | ||
| size_limit_bytes = parse_bytes(_update_with_defaults(entry_size_limit, "entry_size_limit")) | ||
| key_prefix = _update_with_defaults(key_prefix, "key_prefix") | ||
|
|
||
| # Create metrics object if enabled | ||
| cache_metrics = None | ||
|
|
@@ -407,6 +411,7 @@ def cachier( | |
| wait_for_calc_timeout=wait_for_calc_timeout, | ||
| entry_size_limit=size_limit_bytes, | ||
| metrics=cache_metrics, | ||
| key_prefix=key_prefix, | ||
| ) | ||
|
Comment on lines
359
to
415
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added tests here 1108356 |
||
| elif backend == "s3": | ||
| core = _S3Core( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
included in docstring 6cd8e5d