Hash table growth

2005-08-15 Thread Jem Berkes
When I looked at the expand function used by apr_hash.c it looked to me 
like it keeps growing if you keep using 'set' with novel values. I was 
thinking of using apr_hash in order to cache DNSBL queries for my module. 
It would ensure rapid cache search but I am having trouble figuring out how 
I could remove existing entries. I really _want_ collisions to happen but 
I'm not sure if this is possible.

Any tips on how I can overwrite existing entries in the hash table, rather 
than keep expanding the table entries?

e.g. key ABC is already in the table, and it collides with XYZ which I now 
want to add. However, if I apr_hash_get(XYZ) it will tell me correctly that 
this key is not present; and apr_hash_set(XYZ) now expands the table right?




Re: Hash table growth

2005-08-15 Thread Garrett Rooney

Jem Berkes wrote:
When I looked at the expand function used by apr_hash.c it looked to me 
like it keeps growing if you keep using 'set' with novel values. I was 
thinking of using apr_hash in order to cache DNSBL queries for my module. 
It would ensure rapid cache search but I am having trouble figuring out how 
I could remove existing entries. I really _want_ collisions to happen but 
I'm not sure if this is possible.


Any tips on how I can overwrite existing entries in the hash table, rather 
than keep expanding the table entries?


As is documented in apr_hash.h, you can remove entries from an 
apr_hash_t by setting the value for the key in question to NULL.


-garrett