Skip to content

refactor: enhance time management and documentation in cache library#136

Open
TKorr wants to merge 1 commit into
mainfrom
fix/ttl-api-guidelines
Open

refactor: enhance time management and documentation in cache library#136
TKorr wants to merge 1 commit into
mainfrom
fix/ttl-api-guidelines

Conversation

@TKorr
Copy link
Copy Markdown
Contributor

@TKorr TKorr commented May 14, 2026

  • Simplified the duration_to_ticks function to use try_from for better clarity and error handling.
  • Improved the Clock trait documentation, adding examples for better usability and understanding.
  • Updated StdClock and MockClock implementations with additional examples to demonstrate usage.
  • Refined the ExpirationIndex to utilize a Deadline type instead of u64, enhancing type safety and clarity in deadline management.
  • Expanded documentation across various components to improve clarity and provide practical examples for users.

These changes enhance the overall usability and maintainability of the cache library, particularly in the context of time-based operations and expiration management.

Description

Related Issue

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📝 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test addition or modification

How Has This Been Tested?

  • Unit tests
  • Integration tests
  • Manual testing

Test environment:

  • OS:
  • Rust version:

Checklist

  • My code follows the project's coding standards
  • I have run cargo fmt and cargo clippy
  • I have added tests for my changes
  • All new and existing tests pass (cargo test)
  • I have updated the documentation as needed
  • I have added an entry to CHANGELOG.md (if applicable)

Screenshots (if applicable)

Additional Notes

- Simplified the `duration_to_ticks` function to use `try_from` for better clarity and error handling.
- Improved the `Clock` trait documentation, adding examples for better usability and understanding.
- Updated `StdClock` and `MockClock` implementations with additional examples to demonstrate usage.
- Refined the `ExpirationIndex` to utilize a `Deadline` type instead of `u64`, enhancing type safety and clarity in deadline management.
- Expanded documentation across various components to improve clarity and provide practical examples for users.

These changes enhance the overall usability and maintainability of the cache library, particularly in the context of time-based operations and expiration management.
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