Skip to content

Commit b6c28ee

Browse files
committed
Update README
1 parent 0b2e6ed commit b6c28ee

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,31 @@ For details about the algorithm and citations please use this article for now
99
["Cuckoo Filter: Better Than Bloom" by Bin Fan, Dave Andersen and Michael Kaminsky](https://www.cs.cmu.edu/~dga/papers/cuckoo-conext2014.pdf)
1010

1111
##Note
12-
This implementation uses a a static bucket size of 4 fingerprints and a fingerprint size of 1 byte based on my understanding of an optimal bucket/fingerprint/size ratio from the aforementioned paper.
12+
This implementation uses a a static bucket size of 4 fingerprints and a fingerprint size of 1 byte based on my understanding of an optimal bucket/fingerprint/size ratio from the aforementioned paper.
13+
14+
##Example usage:
15+
```go
16+
17+
import "github.com/seiflotfy/cuckoofilter"
18+
19+
cf := cuckoofilter.NewDefaultCuckooFilter()
20+
cf.InsertUnique("geeky ogre")
21+
22+
// Lookup a string (and it a miss) if it exists in the cuckoofilter
23+
cf.Lookup("hello")
24+
25+
count := cf.GetCount()
26+
// count == 1
27+
28+
// Delete a string (and it a miss)
29+
cf.Delete("hello")
30+
31+
count := cf.GetCount()
32+
// count == 1
33+
34+
// Delete a string (a hit)
35+
cf.Delete("geeky ogre")
36+
37+
count := cf.GetCount()
38+
// count == 0
39+
```

0 commit comments

Comments
 (0)