| 214 | } |
| 215 | |
| 216 | func (r *redisCache) encodeMetadata(contentMetadata *ContentMetadata) []byte { |
| 217 | cLength := contentMetadata.Length |
| 218 | cType := r.encodeString(contentMetadata.Type) |
| 219 | cEncoding := r.encodeString(contentMetadata.Encoding) |
| 220 | b := make([]byte, 0, len(cEncoding)+len(cType)+8) |
| 221 | b = append(b, byte(cLength>>56), byte(cLength>>48), byte(cLength>>40), byte(cLength>>32), byte(cLength>>24), byte(cLength>>16), byte(cLength>>8), byte(cLength)) |
| 222 | b = append(b, cType...) |
| 223 | b = append(b, cEncoding...) |
| 224 | return b |
| 225 | } |
| 226 | |
| 227 | func (r *redisCache) decodeMetadata(b []byte) (*ContentMetadata, int, error) { |
| 228 | if len(b) < 8 { |