8000 added expiration index, upgrade deprecating method by wangsha · Pull Request #4 · wangsha/cachelib · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

added expiration index, upgrade deprecating method #4

New issue

Have a question about this project? Sign up for a f 10000 ree 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

Merged
merged 10 commits into from
Mar 13, 2025

Conversation

wangsha
Copy link
Owner
@wangsha wangsha commented Mar 13, 2025

This pull request includes changes to the dynamodb.py and mongodb.py cache libraries, as well as their corresponding tests. The changes focus on updating the method for obtaining the current UTC time and ensuring the creation of an expiration index in MongoDB.

Changes to datetime handling:

  • src/cachelib/dynamodb.py: Modified the _utcnow method to use datetime.now(datetime.UTC) instead of datetime.utcnow() for obtaining the current UTC time.
  • src/cachelib/mongodb.py: Modified the _utcnow method to use datetime.now(datetime.UTC) instead of datetime.utcnow() for obtaining the current UTC time.

Changes to MongoDB index creation:

  • src/cachelib/mongodb.py: Added a check to create an index on the "expiration" field if it does not already exist.
  • tests/test_mongodb_cache.py: Added an assertion to verify the creation of the "expiration" index in the MongoDB cache tests.<!--
    Before opening a PR, open a ticket describing the issue or feature the PR will address. Follow the steps in CONTRIBUTING.rst.

Replace this comment with a description of the change. Describe how it addresses the linked ticket.
-->

  • fixes #

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code.
  • Add an entry in CHANGES.rst summarizing the change and linking to the issue.
  • Add .. versionchanged:: entries in any relevant code docs.
  • Run pre-commit hooks and fix any issues.
  • Run pytest and tox, no tests failed.

@wangsha wangsha merged commit 6d53797 into main Mar 13, 2025
6 checks passed
@wangsha wangsha deleted the feature/mongodb-auto-expire-index branch March 13, 2025 06:28
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.

1 participant
0