ankursaxena
October 17th, 2002, 11:33 AM
Hi! I have a small problem, more than a language construct problem this is a logical problem, I have a soft switch which talks to me to get authorization for a phone call to go through. Now the data is stored in the database and each time a phone call is made, i have to make the call to the database, which is kind of expensive. Now what i want is to distribute my current logic which contains everything into:
Authorization Controller, Database Manager, Cache Manager.
Now when a request comes from the softswitch, i first check the cache manager and if it doesnt exists then query the mysql manager, and get my data. Now i take this data and replace it with the oldest record in cache. this is done by the cache manager itself.
Does this sound like a good plan, or something better can be used. It would be great if someone could help me on that. But the main problem is that i have to design the cache manager, now I dont know what data structure to use to manage these phones numbers, should I use a plain array, or a balanced tree or hash table, the numbers are going to be random, so just throwing that in, if that helps, but the numbers associated with a particular autharization controller would be in sequence like 8472851000-8472851999 and 847xxxyyyy-847xxxzzzz(both with 1 AC)
Also the data stored in the cache would not only contain the phone number, but also some settings which are required frequently, so a single entry of a phone number would be close to 1k.
Thanks for all the help.
Regards,
Ankur
Authorization Controller, Database Manager, Cache Manager.
Now when a request comes from the softswitch, i first check the cache manager and if it doesnt exists then query the mysql manager, and get my data. Now i take this data and replace it with the oldest record in cache. this is done by the cache manager itself.
Does this sound like a good plan, or something better can be used. It would be great if someone could help me on that. But the main problem is that i have to design the cache manager, now I dont know what data structure to use to manage these phones numbers, should I use a plain array, or a balanced tree or hash table, the numbers are going to be random, so just throwing that in, if that helps, but the numbers associated with a particular autharization controller would be in sequence like 8472851000-8472851999 and 847xxxyyyy-847xxxzzzz(both with 1 AC)
Also the data stored in the cache would not only contain the phone number, but also some settings which are required frequently, so a single entry of a phone number would be close to 1k.
Thanks for all the help.
Regards,
Ankur