Skip to content

Commit b7ccf30

Browse files
authored
file: add LoadFromFileMaxBytes (#89)
1 parent 8cfcf81 commit b7ccf30

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

file.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ func (c *Cache) SaveToFileConcurrent(filePath string, concurrency int) error {
7676
return nil
7777
}
7878

79+
// LoadFromFileMaxBytes loads cache data from the specified filePath,
80+
// enforcing that the cache capacity matches the provided maxBytes value.
81+
//
82+
// Returns an error if the stored cache's capacity differs from maxBytes.
83+
//
84+
// See SaveToFile* for functions that persist cache data to a file.
85+
func LoadFromFileMaxBytes(filePath string, maxBytes int) (*Cache, error) {
86+
return load(filePath, maxBytes)
87+
}
88+
7989
// LoadFromFile loads cache data from the given filePath.
8090
//
8191
// See SaveToFile* for saving cache data to file.

0 commit comments

Comments
 (0)