MAY have extras. MUST NOT have key. MUST NOT have value. Extra data for flush: Byte/ 0 | 1 | 2 | 3 | / | | | | |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| +---------------+---------------+---------------+---------------+ 0| Expiration
| 307 | // +---------------+---------------+---------------+---------------+ |
| 308 | // Total 4 bytes |
| 309 | bool MemcacheRequest::Flush(uint32_t timeout) { |
| 310 | const uint8_t FLUSH_EXTRAS = (timeout == 0 ? 0 : 4); |
| 311 | FlushHeaderWithExtras header_with_extras = {{ |
| 312 | policy::MC_MAGIC_REQUEST, |
| 313 | policy::MC_BINARY_FLUSH, |
| 314 | 0, |
| 315 | FLUSH_EXTRAS, |
| 316 | policy::MC_BINARY_RAW_BYTES, |
| 317 | 0, |
| 318 | butil::HostToNet32(FLUSH_EXTRAS), |
| 319 | 0, |
| 320 | 0 }, butil::HostToNet32(timeout) }; |
| 321 | if (FLUSH_EXTRAS == 0) { |
| 322 | if (_buf.append(&header_with_extras.header, |
| 323 | sizeof(policy::MemcacheRequestHeader))) { |
| 324 | return false; |
| 325 | } |
| 326 | } else { |
| 327 | if (_buf.append(&header_with_extras, sizeof(header_with_extras))) { |
| 328 | return false; |
| 329 | } |
| 330 | } |
| 331 | ++_pipelined_count; |
| 332 | return true; |
| 333 | } |
| 334 | |
| 335 | // (if found): |
| 336 | // MUST have extras. |