Conversions between numeric keys/values and the types expected by Cache.
| 19 | |
| 20 | // Conversions between numeric keys/values and the types expected by Cache. |
| 21 | static std::string EncodeInt(int k) { |
| 22 | kudu::faststring result; |
| 23 | kudu::PutFixed32(&result, k); |
| 24 | return result.ToString(); |
| 25 | } |
| 26 | static int DecodeInt(const Slice& k) { |
| 27 | CHECK_EQ(4, k.size()); |
| 28 | return kudu::DecodeFixed32(k.data()); |