Skip to content

v0.21.0

Latest

Choose a tag to compare

@aisk aisk released this 22 Aug 15:22
· 13 commits to master since this release

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 Memcache with verbs named for what you are doing: get, set, delete, counters, update (read, compare and swap, retry loop handled internally) and fetch (compute a missing value once, with dogpile protection via leases)
  • AsyncMemcache on tokio, behind the tokio feature, with the same verb set
  • Scenario layer built on plan / finish functions 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
  • Router trait for custom placement, with rendezvous hashing as the default
  • Failure policy (degrade) and an on_error observability hook
  • Keys accept anything AsRef<[u8]>; client_flags override on writes

Types

  • New Ttl, Freshness, Encode / Decode traits and a dedicated exp::Error type
  • Protocol layer now works on Ttl and raw byte values
  • New serde_json feature: serialize values to JSON via serde

Batches

  • run_batch reports per-operation results instead of a single outcome
  • Typed run_many batch 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

  • MetaClient replaced by Memcache / AsyncMemcache
  • get_touch renamed to get_and_touch
  • MutationStatus::Stored renamed to Applied
  • version option renamed to force_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 in docs/exp.zh-CN.md
  • README feature list reworked to separate the experimental exp client from the stable Client
  • 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 to tests/test_exp_meta_client.rs

Full Changelog: v0.20.0...v0.21.0