MCPcopy
hub / github.com/filebrowser/filebrowser / GetLength

Method GetLength

http/upload_cache_redis.go:56–73  ·  view source on GitHub ↗
(filePath string)

Source from the content-addressed store, hash-verified

54}
55
56func (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
75func (c *redisUploadCache) Touch(filePath string) {
76 err := c.client.Expire(context.Background(), c.filePathKey(filePath), uploadCacheTTL).Err()

Callers

nothing calls this directly

Calls 3

filePathKeyMethod · 0.95
TouchMethod · 0.95
GetMethod · 0.65

Tested by

no test coverage detected