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.
This pull request introduces several new features and improvements to the
advanced_cachinglibrary, focusing on enhanced Redis serialization flexibility, easier hybrid cache setup, and better test coverage. The most significant changes are the addition of pluggable serializers forRedisCache, a new helper for streamlined hybrid cache creation, independent TTL control for cache layers, and expanded documentation and tests.Core enhancements:
pickle(default),json, or provide custom serializer objects. This is implemented via a newSerializerprotocol and thePickleSerializerandJsonSerializerclasses. The serialization logic automatically wraps or unwraps cache entries as needed. (src/advanced_caching/storage.py,src/advanced_caching/__init__.py) [1] [2] [3] [4] [5] [6] [7] [8] [9]l2_ttlparameter toHybridCachefor independent control of the L2 (Redis) TTL, defaulting to twice the L1 TTL if not specified. All relevant methods now respect this parameter. (src/advanced_caching/storage.py) [1] [2] [3] [4]HybridCache.from_redishelper (documented in the changelog) for simplified L1+L2 cache setup.Testing and documentation:
HybridCachel2_ttlbehavior, ensuring correct instantiation and cache operation. (tests/test_correctness.py)CHANGELOG.mdwith a new release section summarizing these features and improvements. (CHANGELOG.md)__version__and new serializer classes in the main module for easier version checking and import. (src/advanced_caching/__init__.py) [1] [2]GITHUB_ACTIONS.mdsetup guide, as it is no longer needed. (GITHUB_ACTIONS.md)tests/test.py)Summary of most important changes:
Serialization and cache flexibility:
pickle(default) andjson, plus customdumps/loadsimplementations. (src/advanced_caching/storage.py,src/advanced_caching/__init__.py) [1] [2] [3] [4] [5] [6] [7] [8] [9]HybridCachenow supports anl2_ttlparameter for independent L2 TTL control, defaulting tol1_ttl * 2if not specified. (src/advanced_caching/storage.py) [1] [2] [3] [4]HybridCache.from_redishelper for easy L1+L2 setup (documented in changelog). (CHANGELOG.md)Testing and documentation:
l2_ttlbehavior. (tests/test_correctness.py)__version__, removed obsolete files. (CHANGELOG.md,src/advanced_caching/__init__.py,GITHUB_ACTIONS.md,tests/test.py) [1] [2] [3] [4] [5]