Skip to content
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

Simplify cache namespace and key encoding logic for v1 #670

Merged
merged 36 commits into from
Feb 27, 2023
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7bd719a
Move namespace logic to BaseCache.build_key()
padraic-shafer Feb 18, 2023
0eeab3e
BaseCache._build_key() needs keyword param
padraic-shafer Feb 18, 2023
25943bd
ut/test_base/alt_base_cache tests use clearer default namespace
padraic-shafer Feb 19, 2023
fcd7afc
Update ut/test_base/alt_base_cache tests with new build_key() namespa…
padraic-shafer Feb 19, 2023
139e0a4
Update redis namespaced key for new build_key() compatibility
padraic-shafer Feb 19, 2023
eebe299
Update memcached key encoding for new build_key() compatibility
padraic-shafer Feb 19, 2023
6622f57
test/ut/test_base.py now calls build_key(), rather than _build_key()
padraic-shafer Feb 19, 2023
54ce48d
Move Enum _ensure_key() logic into BaseCache:build_key()
padraic-shafer Feb 19, 2023
b2e58d7
Update changelog with revisied cache build_key() scheme
padraic-shafer Feb 19, 2023
223b537
Clarify that output of BaseCache key_builder arg should be a string
padraic-shafer Feb 19, 2023
e8d6037
Clarify 'key_builder' parameter docstring in 'BaseCache.__init__()'
padraic-shafer Feb 20, 2023
9da3608
Merge branch 'master' into simplify-cache-namespace
padraic-shafer Feb 21, 2023
db94261
Ensure that cache namespace is a string
padraic-shafer Feb 21, 2023
84ce34c
mypy annotations for build_key() with namespace
padraic-shafer Feb 22, 2023
8392b15
Merge branch 'master' into simplify-cache-namespace
padraic-shafer Feb 22, 2023
16db995
Define BaseCache as generic, typed by backend cache key
padraic-shafer Feb 23, 2023
9dc7c77
Update tests for BaseCache with TypeVar
padraic-shafer Feb 24, 2023
a757e9a
Propagate type annotations for mypy compliance
padraic-shafer Feb 24, 2023
54093a1
Resolve mypy type annotations in tests
padraic-shafer Feb 24, 2023
d00a18b
Default namespace is empty string for decorators
padraic-shafer Feb 24, 2023
7239f16
Call build_key() with namespace as positional argument
padraic-shafer Feb 24, 2023
5995d64
redis.asyncio.Redis is generic for type checking purposes, but not at…
padraic-shafer Feb 24, 2023
e8c2306
Update alt_key_builder example with revised build_key() logickey_builder
padraic-shafer Feb 24, 2023
4126d60
Remove unneeded typing in decorator tests [mypy]
padraic-shafer Feb 24, 2023
3563def
BaseCache key_builder param defaults to lambda
padraic-shafer Feb 24, 2023
07e1919
Remove extraneous comments
padraic-shafer Feb 24, 2023
589d2b8
Remove bound on CacheKeyType
padraic-shafer Feb 24, 2023
08d8bf9
Correct the return annotation for redis_client fixture
padraic-shafer Feb 24, 2023
08b70d7
Test for abstract BaseCache
padraic-shafer Feb 24, 2023
64436a0
Revert extraneous mypy typing fixes
padraic-shafer Feb 24, 2023
bc385f7
Revise the changelog for PR #670
padraic-shafer Feb 24, 2023
396952f
Update redis.py
Dreamsorcerer Feb 27, 2023
6c4780e
Update base.py
Dreamsorcerer Feb 27, 2023
ce2f26a
Update alt_key_builder.py
Dreamsorcerer Feb 27, 2023
3d50611
Update CHANGES.rst
Dreamsorcerer Feb 27, 2023
23cd481
Update CHANGES.rst
Dreamsorcerer Feb 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update CHANGES.rst
Dreamsorcerer authored Feb 27, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 23cd481b7eb29391a6c34c15ee82737123d1b5b9
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ There are a number of backwards-incompatible changes. These points should help w
* When using the ``key_builder`` parameter in ``@multicached``, the function will now return the original, unmodified keys, only using the transformed keys in the cache (this has always been the documented behaviour, but not the implemented behaviour).
* ``BaseSerializer`` is now an ``ABC``, so cannot be instantiated directly.
* If subclassing ``BaseCache`` to implement a custom backend:

* The cache key type used by the backend must now be specified when inheriting (e.g. ``BaseCache[str]`` typically).
* The ``build_key()`` method must now be defined (this should generally involve calling ``self._str_build_key()`` as a helper).