Feature #62

Caching to MySQL database

Added by jacobsj over 1 year ago. Updated over 1 year ago.

Status:Closed Start:05/12/2009
Priority:Normal Due date:
Assigned to:jacobsj % Done:

100%

Category:-
Target version:Caller ID Superfecta v 2.1.0 Estimated time:3.00 hours

Description

I think the MySQL cache should be inserted as a source file like other sources, this will allow it to be sorted, that way you can the AsteriDex or Asterisk Phonebook or SugarCRM (all of which can be as fast as a cache lookup) placed before the cache lookup.

I'm guessing we should have some an expiration date on cache values, so that the value needs to be renewed after so many days. This should probably be a user defined value.

There should be some mechanism built into the UI to clear the cache as well.

History

Updated by tshif over 1 year ago

  • Status changed from New to Reviewed

I have no objection - but why wouldn't we use the caching mechanism built into freePBX. Its one of the reasons we added the Asterisk Phone book to the Superfecta module -
http://pbxinaflash.com/forum/showpost.php?p=26980&postcount=59

Updated by jacobsj over 1 year ago

I have several reasons for not using the Built in Asterisk Phone book off the top of my head.
  1. If we have our own cache, we can easily control it's age and/or size without worrying that there isn't an efficient way to clean it out, the module can handle it.
  2. I'm not sure what the Asterisk Phone book uses for it's database, but if the tables are designed properly, we can achieve very fast look-ups with millions of records in cache, so only in extreme situations would we have to worry about speed or a cache that is too large even if we never cleaned out the cache.
  3. If enabled, people can use the Asterisk Phone book through the IVR. This means that employees can call into the phone system, get into the phone book and call out to a vendor if they are off site and don't have the vendor's phone number handy. For people that want to use the phone book for their own personal phone book, I think it's a good idea to cache CID elsewhere.

Updated by nerduno over 1 year ago

My only worry with a new cache is that it's one more thing to break. If the Asterisk Phonebook and cache are the same thing, all I can tell you is that it works great. The only wrinkle with it has been cleaning it out if we get a bad lookup source that sticks all sorts of HTML crap in it. I write a script to clean it out whenever someone wants to. Here's a link to the script: http://tr.im/lep2

Either way works for me. Would we not still support the Asterisk cache in either case??

Updated by tshif over 1 year ago

Yes - definitely we will continue to support the Asterisk Phonebook cache. Since the Asterisk Phonebook data source has been built, and FreePBX handles the chacheing - Its a done deal.

My understanding is the Asterisk database is a berkley db.

I do see the importance of having a potential cache that is not available through Asterisk, as Jeremy says "For people that want to use the phone book for their own personal phone book". Its not our work style, or any of our customers, but I recognize that it should remain an option.

Updated by jacobsj over 1 year ago

  • Assigned to set to jacobsj
  • % Done changed from 0 to 90

There is not an additional table in the asterisk schema that is needed for this cache.

You can either compile the module and install to start testing (in other words have the install process create the table) Or you can manually create the table. Here is the mysql insert statement:
CREATE TABLE IF NOT EXISTS superfectacache (number BIGINT UNSIGNED NOT NULL, callerid VARCHAR NOT NULL, dateentered DATETIME NOT NULL, PRIMARY KEY (number)) ENGINE = MyISAM;

Please test and verify operation.

Updated by tshif over 1 year ago

Testing has begun..

Updated by tshif over 1 year ago

  • Status changed from Reviewed to Closed
  • % Done changed from 90 to 100

QA: PASSED Superfecta Cache Source appears to function as expected. previously looked up results are cached and available to subsequent inbound redials. Unable to test the cache expiration.

Also available in: Atom PDF