-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathencoding_example_test.go
More file actions
29 lines (26 loc) · 908 Bytes
/
encoding_example_test.go
File metadata and controls
29 lines (26 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package cuckoo
import "fmt"
func ExampleFilter_Save() {
filter := New()
item := []byte("Largo")
filter.InsertUnique(item)
filter.Save("./tmp/example_save.gob")
loadedFilter, _ := Load("./tmp/example_save.gob")
fmt.Printf("Loaded filter has same item? %v\n\n", loadedFilter.Lookup(item))
fmt.Printf("[Old]\nBucketEntries: %v\nBucketTotal: %v\nFingerprint: %v\nKicks: %v\n\n", filter.bucketEntries, filter.bucketTotal, filter.fingerprintLength, filter.kicks)
fmt.Printf("[Loaded]\nBucketEntries: %v\nBucketTotal: %v\nFingerprint: %v\nKicks: %v\n", loadedFilter.bucketEntries, loadedFilter.bucketTotal, loadedFilter.fingerprintLength, loadedFilter.kicks)
// Output:
// Loaded filter has same item? true
//
// [Old]
// BucketEntries: 24
// BucketTotal: 4194304
// Fingerprint: 6
// Kicks: 500
//
// [Loaded]
// BucketEntries: 24
// BucketTotal: 4194304
// Fingerprint: 6
// Kicks: 500
}