Skip to content

Commit 8cfcf81

Browse files
authored
Revert "file: load from file should allow configure maxBytes (#86)" (#88)
This reverts commit 198c85e.
1 parent 198c85e commit 8cfcf81

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

file.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ func (c *Cache) SaveToFileConcurrent(filePath string, concurrency int) error {
7979
// LoadFromFile loads cache data from the given filePath.
8080
//
8181
// See SaveToFile* for saving cache data to file.
82-
func LoadFromFile(filePath string, maxBytes int) (*Cache, error) {
83-
return load(filePath, maxBytes)
82+
func LoadFromFile(filePath string) (*Cache, error) {
83+
return load(filePath, 0)
8484
}
8585

8686
// LoadFromFileOrNew tries loading cache data from the given filePath.

file_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestSaveLoadSmall(t *testing.T) {
2828
t.Fatalf("SaveToFile error: %s", err)
2929
}
3030

31-
c1, err := LoadFromFile(filePath, 0)
31+
c1, err := LoadFromFile(filePath)
3232
if err != nil {
3333
t.Fatalf("LoadFromFile error: %s", err)
3434
}
@@ -47,7 +47,7 @@ func TestSaveLoadSmall(t *testing.T) {
4747
}
4848

4949
func TestLoadFileNotExist(t *testing.T) {
50-
c, err := LoadFromFile(`non-existing-file`, 0)
50+
c, err := LoadFromFile(`non-existing-file`)
5151
if err == nil {
5252
t.Fatalf("LoadFromFile must return error; got nil")
5353
}
@@ -105,7 +105,7 @@ func testSaveLoadFile(t *testing.T, concurrency int) {
105105
c.Reset()
106106

107107
// Verify LoadFromFile
108-
c, err = LoadFromFile(filePath, 0)
108+
c, err = LoadFromFile(filePath)
109109
if err != nil {
110110
t.Fatalf("unexpected error: %s", err)
111111
}
@@ -240,7 +240,7 @@ func TestSaveLoadConcurrent(t *testing.T) {
240240
if err := c.SaveToFileConcurrent(filePath, 3); err != nil {
241241
panic(fmt.Errorf("cannot save cache to %q: %s", filePath, err))
242242
}
243-
cc, err := LoadFromFile(filePath, 0)
243+
cc, err := LoadFromFile(filePath)
244244
if err != nil {
245245
panic(fmt.Errorf("cannot load cache from %q: %s", filePath, err))
246246
}

file_timing_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func benchmarkLoadFromFile(b *testing.B, concurrency int) {
5151
b.ResetTimer()
5252
b.SetBytes(benchCacheSize)
5353
for i := 0; i < b.N; i++ {
54-
c, err := LoadFromFile(filePath, 0)
54+
c, err := LoadFromFile(filePath)
5555
if err != nil {
5656
b.Fatalf("cannot load cache from file: %s", err)
5757
}

0 commit comments

Comments
 (0)