Conversions between numeric keys/values and the types expected by Cache.
| 16 | |
| 17 | // Conversions between numeric keys/values and the types expected by Cache. |
| 18 | static std::string EncodeKey(int k) { |
| 19 | std::string result; |
| 20 | PutFixed32(&result, k); |
| 21 | return result; |
| 22 | } |
| 23 | static int DecodeKey(const Slice& k) { |
| 24 | assert(k.size() == 4); |
| 25 | return DecodeFixed32(k.data()); |