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

Add a crate feature sync for enabling and disabling sync caches #143

Merged
merged 7 commits into from
May 29, 2022

Conversation

tatsuya6502
Copy link
Member

@tatsuya6502 tatsuya6502 commented May 29, 2022

Summary

This PR adds a crate feature sync for enabling and disabling sync caches (sync::Cache and sync::SegmentedCache). When enabled, sync caches will be available for use. This feature is enabled by default.

The sync feature will be especially useful when you use experimental dash::Cache because now you can opt out some dependencies such as crossbeam-epoch and uuid by disabling both sync and future features.

Usage

# This is your Cargo.toml

[dependencies]

# Use dash cache, but no other (sync/future) caches.
# Note: "sync" is enabled by default, so you need to disable the default features.
moka = { version = "x.y.z", default-features = false, features = ["dash, atomic64", "quanta"] }

Changes

New crate feature sync:

  • Add the sync feature and make it enabled by default.
  • Breaking change: Disabling the default features will disable sync caches.
  • Update the CI configurations for the sync feature.

future::Cache changes:

  • Breaking change: The iterator type for future::Cache has been changed from sync::Iter to future::Iter.
  • Breaking change: The return type of future::Cache::invalidate_entries_if method has been changed from Result<sync::PredicateId, _> to Result<future::PredicateId, _>.

Note that this PR will be merged into the next branch for Moka v0.9.0 release. (Currently, the master branch is for Moka v0.8.x releases)


Fixes #140

Milo123459 and others added 7 commits May 28, 2022 09:08
Note: This does not compile.

Conflicts:
  src/lib.rs
- The `sync` feature:
    - It controls the availability of the `sync` module. (e.g. `sync::Cache`
      and `sync::SegmentedCache`)
    - It is enabled by default.
- `future::Cache`:
    - The iterator type for `future::Cache` has been changed from `sync::Iter`
      to `future::Iter`.
    - The return type of `future::Cache::invalidate_entries_if` method has been
      changed from `Result<sync::PredicateId, _>` to `Result<future::PredicateId, _>`.
- Update the CI configurations for the `sync` feature.
@tatsuya6502 tatsuya6502 self-assigned this May 29, 2022
@tatsuya6502 tatsuya6502 added the enhancement New feature or request label May 29, 2022
@tatsuya6502 tatsuya6502 added this to the v0.9.0 milestone May 29, 2022
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 into the next branch.

@tatsuya6502 tatsuya6502 merged commit 2ebcc66 into next May 29, 2022
@tatsuya6502 tatsuya6502 deleted the gh141-optout-sync branch May 29, 2022 11:34
@tatsuya6502 tatsuya6502 linked an issue May 29, 2022 that may be closed by this pull request
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.

Are there certain dependencies that can be removed?
2 participants