Skip to content

refactor: update cache storage initialization to use create_with method - #16

Merged
zoola969 merged 2 commits into
masterfrom
add-create-with-method
Aug 28, 2025
Merged

refactor: update cache storage initialization to use create_with method#16
zoola969 merged 2 commits into
masterfrom
add-create-with-method

Conversation

@zoola969

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings August 28, 2025 06:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the cache storage initialization approach by replacing lambda functions with a new create_with class method for TTLMapStorage and TTLMapAsyncStorage. This change improves code readability and provides a more consistent API pattern for storage configuration.

  • Introduces create_with class methods that return callables for creating storage instances
  • Updates all documentation and test files to use the new initialization pattern
  • Maintains backward compatibility while offering a cleaner alternative to lambda-based initialization

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cachium/storages/ttl_map.py Adds create_with class methods to both storage classes for simplified instantiation
tests/test__decorator.py Updates test cases to use new create_with method instead of lambda functions
docs/index.md Updates documentation examples to demonstrate new initialization pattern
docs/guides/tutorials.md Updates tutorial examples with new storage initialization approach
docs/guides/quickstart.md Updates quickstart guide to use create_with method
docs/examples.md Updates all code examples to use new storage initialization pattern
cachium/_decorators.py Updates docstring example to show new initialization method
README.md Refactors examples to use new pattern and improves async example clarity
todo Minor addition of refactor task item

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread cachium/storages/ttl_map.py Outdated
Comment thread tests/test__decorator.py Outdated
@zoola969
zoola969 merged commit 85e4530 into master Aug 28, 2025
10 checks passed
@zoola969
zoola969 deleted the add-create-with-method branch August 28, 2025 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants