[SR-Users] Creating array out of hashtable

Daniel-Constantin Mierla miconda at gmail.com
Mon Sep 8 11:38:39 CEST 2014


Hello,

On 08/09/14 10:50, aft wrote:
> [1]Is it possible to iterate a htable without using "keys" like an array?

there is no possibility to iterate the hash table from configuration 
file. The structure is stored in memory, with locks per slots, to be 
optimized for parallel processing.

For a consistent iteration, the lock has to be at hash table level, 
which will impact the performances a lot.

An alternative would be to add iteration still using the locks on slots, 
but that means new items can be added/removed/updated in other slots 
while walking on a slot. So it is not like taking a snapshot of hash 
table content at a specific time.

Also, maybe you can provide more details about what you need to achieve, 
there could be other options to try.

> [2] Is it possible to search for "keys" using regxp?
It is possible to count items by regular expression matching on key or 
value, see:

- 
http://www.kamailio.org/wiki/cookbooks/4.1.x/pseudovariables#shtcn_htable_exp

As well as deleting items:

- 
http://kamailio.org/docs/modules/stable/modules/htable.html#htable.f.sht_rm_name_re

Cheers,
Daniel



More information about the sr-users mailing list