Changelog

v2.2.0

A synchronous increment for the hybrid limiters, and a borrowed Redis key type.

Status: Released · October 4, 2026

Version 2.2.0 adds a synchronous increment to the two hybrid limiters and a borrowed form of the Redis key.

Added

  • Added try_inc(key, count) to the absolute and suppressed hybrid limiters. It is synchronous. It makes the decision from the local state of the instance and does not wait for Redis.
  • try_inc returns Ok(None) and records nothing when the decision needs Redis. This occurs for a new key, for expired local state, and when the local capacity is used. Then call inc.
  • Added RedisKeyRef, a borrowed key with the same validation rules as RedisKey. RedisKeyRef::try_from accepts a &str and does not allocate.
  • Added RedisKey::as_key_ref(). It borrows an owned key and does not validate the key again.
  • RedisKey now implements Borrow<str>. Thus, a map with RedisKey keys accepts a &str for a lookup.
let decision = match provider.absolute().try_inc(key.as_key_ref(), 1)? {
    Some(decision) => decision,
    None => provider.absolute().inc(&key, &rate, 1).await?,
};

See Deciding without awaiting.

trypema 2.2.0 on crates.io