(filePath string)
| 54 | } |
| 55 | |
| 56 | func (c *redisUploadCache) GetLength(filePath string) (int64, error) { |
| 57 | result, err := c.client.Get(context.Background(), c.filePathKey(filePath)).Result() |
| 58 | if err != nil { |
| 59 | if errors.Is(err, redis.Nil) { |
| 60 | return 0, fmt.Errorf("no active upload found for the given path") |
| 61 | } |
| 62 | return 0, fmt.Errorf("redis error: %w", err) |
| 63 | } |
| 64 | |
| 65 | size, err := strconv.ParseInt(result, 10, 64) |
| 66 | if err != nil { |
| 67 | return 0, fmt.Errorf("invalid upload length in cache: %w", err) |
| 68 | } |
| 69 | |
| 70 | c.Touch(filePath) |
| 71 | |
| 72 | return size, nil |
| 73 | } |
| 74 | |
| 75 | func (c *redisUploadCache) Touch(filePath string) { |
| 76 | err := c.client.Expire(context.Background(), c.filePathKey(filePath), uploadCacheTTL).Err() |
nothing calls this directly
no test coverage detected