Skip to content
New issue

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

API stabilization: Smaller core cache API, prefer shorter names for common methods #105

Merged
merged 8 commits into from
Mar 22, 2022

Conversation

tatsuya6502
Copy link
Member

@tatsuya6502 tatsuya6502 commented Mar 21, 2022

Rename the following cache methods, and make the methods with old names deprecated:

  • get_or_insert_with(K, F)get_with(K, F)
  • get_or_try_insert_with(K, F)try_get_with(K, F)

Add policy() method to caches returning a cache Policy struct. Move the following cache methods to it:

  • max_capacity()policy().max_capacity()
  • num_segments()policy().num_segments()
  • time_to_live()policy().time_to_live()
  • time_to_idle()policy().time_to_idle()

Add blocking() method to future::Cache returning a BlockingOp struct. Move the following cache methods to it:

  • blocking_insert(K, V)blocking().insert(K, V)
  • blocking_invalidate(K, V)blocking().invalidate(K, V)

cache policy

- Rename the following cache methods, and make the methods wih old
  names deprecated:
    - `get_or_insert_with` -> `get_with`
    - `get_or_try_insert_with` -> `try_get_with`
- Add cache `Policy` and move the following cache methods to it:
    - `max_capacity`
    - `num_segments`
    - `time_to_live`
    - `time_to_idle`
@tatsuya6502 tatsuya6502 self-assigned this Mar 21, 2022
@tatsuya6502 tatsuya6502 added this to the v0.8.0 milestone Mar 21, 2022
@tatsuya6502 tatsuya6502 linked an issue Mar 21, 2022 that may be closed by this pull request
- Add `blocking()` method to `future::Cache` returning `BlockingOp`.
- Move the following methods from `future::Cache` to `BlockingOp`:
    - `blocking_insert()` -> `blocking().insert()`
    - `blocking_invalidate()` -> `blocking().invalidate()`
@tatsuya6502 tatsuya6502 added the enhancement New feature or request label Mar 22, 2022
@tatsuya6502 tatsuya6502 marked this pull request as ready for review March 22, 2022 10:22
Fix broken doc links between `future::Cache` and `future::BlockingOp`.
Fix broken links in the CHANGELOG.
Copy link
Member Author

@tatsuya6502 tatsuya6502 left a comment

Choose a reason for hiding this comment

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

Merging.

@tatsuya6502 tatsuya6502 merged commit 5015431 into master Mar 22, 2022
@tatsuya6502 tatsuya6502 deleted the api-change1 branch March 22, 2022 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: API stabilization
1 participant