FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix description cache invalidation by emphor11 · Pull Request #1715 · openml/openml-python · GitHub

Fix description cache invalidation - #1715

Open
emphor11 wants to merge 2 commits into
openml:mainfrom
emphor11:fix-description-cache-invalidation
Open

Fix description cache invalidation#1715
emphor11 wants to merge 2 commits into
openml:mainfrom
emphor11:fix-description-cache-invalidation

Conversation

Copy link
Copy Markdown

Metadata

Details

This PR implements time-based cache invalidation for dataset descriptions in _get_dataset_description.

Currently, the dataset description (description.xml) is cached indefinitely once downloaded. However, dataset metadata such as status (e.g., active or deactivated) can change on the server. Because the cache never expires, users may receive outdated dataset metadata if the local cache becomes stale.

This change introduces a simple TTL (time-to-live) mechanism for the cached description file:

  • A module-level constant DESCRIPTION_CACHE_TTL is introduced (24 hours).
  • When _get_dataset_description is called, the modification time of the cached description.xml file is checked.
  • If the file is older than the TTL, it is removed and the description is fetched again from the server.

This ensures that cached dataset descriptions are periodically refreshed while still preserving the existing caching behavior and minimizing additional API calls.

The change addresses the existing TODO in the code suggesting that the cache should invalidate itself after some time.

Copy link
Copy Markdown
Author

Hi @fkiraly
Made changes to implement time-based cache invalidation for _get_dataset_description, addressing the TODO about cache invalidation.

Thanks

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement time-based cache invalidation for dataset description cache

1 participant


Back | FazBrowse Home | New Git URL