[OpenSIPS-Users] feature request feedback
Brett Nemeroff
brett at nemeroff.com
Fri May 22 16:09:09 CEST 2009
Hey All,I just had this revelation today about a potential feature and I
wanted to run it by the group to see if there was any interest in it. I
tried posting it to the tracker, but sf.net keeps failing (I'm getting
server busy messages.. grumble..)
So I had talked before about "memcache families". This is where you can
store data into separate memcache namespaces. This would be useful to store
and purge large sets for data at one time..
Think for a minute about routes being loaded into memcache....
Say for example, if I had 10 customers. Each with their own unique route
table with 3 million records each. As one table, that would be 30 million
total routes.. Which may be slow to traverse (not sure, haven't tested).
However if each route table is in it's own family (ie: namespace in
memcache) it would only be 3 million. Which should be very fast. Also, if
I'm changing just one route, I wouldn't have to purge my entire memcache
store to update it.. just the one route table effected.. Also, I use
memcache to store my IP to account relationships.. so we don't need those to
reload either.. That's the idea of memcache families; only update the family
that makes sense. It would only add one additional option to the cache_store
and cache_fetch functions (family). And would also add a function
cache_family_purge, which would delete an entire family of data.
Now building on that idea is my next feature request (which really doesn't
depend on memcache families, but it makes sense to combine the two):
This is a request for the ability to "find_best_match" in memcache family.
This is a function that you'd pass a memcache family to and it would take
the input value (say $rU for example) and keep removing a character from it
until it hit a match and then return the cached value. Of course, this also
depends on preloaded cache values. Which I'd load from an external script
upon startup.
Function usage would be like this:
find_best_match("<memcache_storage_engine>","<memcache_family_name>","<value_to_search_with>",<avp_to_recieve_results>)
There is a *ton* that can be done with this.. My mind is spinning. :) ie:
return 1.2.3.4_<prefix> Then use the transformations to pull the prefix out
and push it into the $rU.. Very powerful.. And you wouldn't even need custom
modules anymore for routing.
So if the dialed number is 5125551212 and in memcache I have: 512555 ->
1.2.3.4 It would hit memcache like this: if
(find_best_match("local","$avp(s:routetable)","$rU",$avp(s:routestring))) {
$rD = $(avp(s:routestring){s.select,0,_}); # rewrite destination $rU = $rU +
$(avp(s:routestring){s.select,1,_}); # add prefix if defined } else {
sl_send_reply("404","No Route"); exit; } 5125551212 -> No Match 512555121 ->
No Match 51255512 -> No Match 5125551 -> No Match 512555 -> 1.2.3.4
Thanks for your consideration and feedback!!
-Brett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20090522/2b4eedf0/attachment.htm
More information about the Users
mailing list