efficient / libcuckoo

A high-performance, concurrent hash table
Other
1.61k stars 275 forks source link

How to efficiently update and delete a record? #64

Closed Michael-Tieying-Zhang closed 7 years ago

Michael-Tieying-Zhang commented 7 years ago

The table is like this : <string, int>. There is function foo that lookups the table with a key. If there is a record matching the key, foo decrease the value by 1. If the value is 0, foo delete the record.

I see there is a update_fn(key, fn) where fn can be defined to update the value. But how can I delete the record using fn ?

manugoyal commented 7 years ago

erase_fn is probably what you need (http://efficient.github.io/libcuckoo/classcuckoohash__map.html#a7c454c5fcdf11a59a576c0602be1a6b4)

Michael-Tieying-Zhang commented 7 years ago

@manugoyal Thanks