What's Changed
This release focuses on the experimental memcache::exp module. The low-level MetaClient from 0.20 is replaced by a high-level client whose verbs hide CAS tokens and leases from caller code. The stable memcache::Client is unchanged.
exp is still experimental and may break between minor versions. Pin the minor version if you depend on it:
[dependencies]
memcache = "0.21"New high-level client: exp::Memcache and exp::AsyncMemcache
- Blocking scenario client
Memcachewith verbs named for what you are doing:get,set,delete, counters,update(read, compare and swap, retry loop handled internally) andfetch(compute a missing value once, with dogpile protection via leases) AsyncMemcacheon tokio, behind thetokiofeature, with the same verb set- Scenario layer built on
plan/finishfunctions in the exp core so both clients share the same logic - Raw meta commands remain reachable through
cache.meta() - Pre-connect builder:
timeout,connect_timeout,max_idle,max_idle_age,max_connections,degrade,on_error,hash_function,router Routertrait for custom placement, with rendezvous hashing as the default- Failure policy (
degrade) and anon_errorobservability hook - Keys accept anything
AsRef<[u8]>;client_flagsoverride on writes
Types
- New
Ttl,Freshness,Encode/Decodetraits and a dedicatedexp::Errortype - Protocol layer now works on
Ttland raw byte values - New
serde_jsonfeature: serialize values to JSON viaserde
Batches
run_batchreports per-operation results instead of a single outcome- Typed
run_manybatch entry point on both clients - Async batches exchange server groups concurrently, bounded by one deadline
- Partial batch responses are order-checked and opaque tokens are verified
Connection handling
- Idle connections are probed before reuse and dropped past
max_idle_age - Per-server connection cap (
max_connections) with token give-back on failure - Redial on stale connections, but not after a timeout
- IO timeout applied as one deadline per exchange in both clients
- Ambiguity attribution: errors distinguish whether a write was fully sent
- Bounded VA length when parsing values
- Routing uses the configured address rather than the resolved one
API renames
MetaClientreplaced byMemcache/AsyncMemcacheget_touchrenamed toget_and_touchMutationStatus::Storedrenamed toAppliedversionoption renamed toforce_cas- exp API types are
#[non_exhaustive]and can no longer be constructed directly
Docs and tests
- New guide in
docs/exp.md, plus a Simplified Chinese version indocs/exp.zh-CN.md - README feature list reworked to separate the experimental
expclient from the stableClient - Documented the routing contract, TTL rules and the lease state matrix
- Integration tests for the scenario layer (
tests/test_memcache.rs); the old meta client tests moved totests/test_exp_meta_client.rs
Full Changelog: v0.20.0...v0.21.0