(bytes []byte)
| 201 | } |
| 202 | |
| 203 | func (r *redisCache) decodeString(bytes []byte) (string, int, error) { |
| 204 | if len(bytes) < 4 { |
| 205 | return "", 0, &RedisCacheCorruptionError{} |
| 206 | } |
| 207 | b := bytes[:4] |
| 208 | n := uint32(b[3]) | (uint32(b[2]) << 8) | (uint32(b[1]) << 16) | (uint32(b[0]) << 24) |
| 209 | if len(bytes) < int(4+n) { |
| 210 | return "", 0, &RedisCacheCorruptionError{} |
| 211 | } |
| 212 | s := bytes[4 : 4+n] |
| 213 | return string(s), int(4 + n), nil |
| 214 | } |
| 215 | |
| 216 | func (r *redisCache) encodeMetadata(contentMetadata *ContentMetadata) []byte { |
| 217 | cLength := contentMetadata.Length |
no outgoing calls