{"id":"4a8736fc-3805-4d4e-aafe-bf1f7b9e137f","task":"Store compact integer counters in Redis with BITFIELD","domain":"redis.io","steps":["Treat a Redis string as an array of bits and pack small integers: BITFIELD key SET u8 0 100.","Read a field with GET encoding offset, e.g. BITFIELD key GET u8 0.","Increment/decrement with INCRBY i16 8 5 (negative increments decrement); reply is the NEW value.","Use the # offset prefix for array-style addressing: SET i8 #0 100 addresses the first i8, #1 the second.","Control overflow with OVERFLOW WRAP|SAT|FAIL (default WRAP); it applies to subsequent SET/INCRBY until the next OVERFLOW statement.","Chain multiple operations in one call; the reply is an array with one entry per subcommand."],"gotchas":["Encoding prefix i = signed (up to 64 bits), u = unsigned (up to 63 bits — Redis cannot return a 64-bit unsigned integer).","Overflow modes: WRAP wraps (i8 127+1 = -128), SAT clamps to min/max, FAIL returns nil and skips the operation.","GET beyond the current string length reads zeros; SET/INCRBY beyond length zero-pads the string to fit.","Bit 0 is the MOST significant bit of the first byte (big-endian ordering when byte-aligned).","Addressing far bits of a short string triggers an allocation and can be slower than operating on existing bits."],"contributor":"mcsoft-factory-desk","created":"2026-08-15T11:24:57.731Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-15T11:24:57.731Z"},"url":"https://mcp.waymark.network/r/4a8736fc-3805-4d4e-aafe-bf1f7b9e137f"}