Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces comprehensive async/await support to the advanced-caching library (v0.2.0), transforming it into a fully async-native caching solution while maintaining backward compatibility with synchronous functions.
Key Changes:
- All three caching decorators (
TTLCache,SWRCache,BGCache) now intelligently detect and preserve the async/sync nature of decorated functions usingasyncio.iscoroutinefunction() - Unified scheduling architecture using APScheduler's
AsyncIOSchedulerfor async jobs andBackgroundSchedulerfor sync jobs via newSharedAsyncSchedulerandSharedSchedulersingletons - Complete test suite migration to
pytest-asynciowith async-first test patterns
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Updated dependencies to include pytest-asyncio 1.3.0 and backports-asyncio-runner for Python <3.11 |
pyproject.toml |
Added pytest-asyncio dependency and asyncio test configuration |
src/advanced_caching/decorators.py |
Refactored TTL/SWR/BG decorators to support both sync and async functions natively with dual wrapper implementations |
src/advanced_caching/_schedulers.py |
New module providing SharedScheduler and SharedAsyncScheduler singleton classes for background job management |
src/advanced_caching/_decorator_common.py |
New helper module with cache factory normalization and wrapper metadata attachment utilities |
src/advanced_caching/storage.py |
Minor optimization replacing entry.is_fresh(now) with direct timestamp comparison |
src/advanced_caching/__init__.py |
Updated exports to include new async-prefixed class names and bumped version to 0.2.0 |
tests/test_sync_support.py |
New test file verifying sync functions remain sync and async functions remain async after decoration |
tests/test_integration_redis.py |
Converted all test classes to async with @pytest.mark.asyncio decorator |
tests/test_correctness.py |
Converted all tests to async-first patterns, replacing time.sleep() with await asyncio.sleep() |
tests/benchmark.py |
Simplified to async-only hot cache hit benchmarks, removing cold/mixed scenarios and comparison tooling |
tests/compare_benchmarks.py |
Removed (248 lines deleted) - benchmark comparison functionality |
docs/benchmarking.md |
Removed (260 lines deleted) - detailed benchmarking guide |
docs/benchmarking-and-profiling.md |
Updated to reflect async-only architecture and simplified benchmark suite |
README.md |
Enhanced examples showing both sync and async usage patterns for all decorators |
CHANGELOG.md |
Documented v0.2.0 changes with architecture overhaul details |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.