Upstream contribution · jaredwray/cacheable
cacheable · Rejecting malformed duration literals before cache TTL conversion
Problem
The shorthand TTL parser could interpret a malformed duration as valid by parsing a numeric prefix. For callers this makes a bad setting look accepted while producing an expiry time different from what they entered.
Engineering response
The change matches the full decimal-and-unit expression and confines decimal parsing to a single optional group. The converter can then apply the supported time unit to a validated number.
Evidence and scope
The PR records regressions for malformed numeric inputs and controls for valid shorthand. These checks address parsing and conversion, with cache behavior downstream dependent on how callers handle invalid values.