Attached is a patch to add caching of whois lookups.
Adds a fieldset to the settings page that allows enabling/disabling caching and setting the length to time to cache results.
In whois_get_whois(), we check the cache for the record first, before doing a lookup.
Patched against 6.x-1.3
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | whois-698850-Add_caching_of_records-5.patch | 6.04 KB | Greg Go |
| #4 | whois-698850-Add_caching_of_records.patch | 5.95 KB | helmo |
| #3 | whois-D6-698850.patch.txt | 4.91 KB | Greg Go |
| #3 | whois-HEAD-698850.patch.txt | 4.44 KB | Greg Go |
| #1 | whois.admin_.inc-cache-patch.txt | 1003 bytes | Greg Go |
Comments
Comment #1
Greg Go commentedattachments didn't take? attaching again.
Comment #2
helmo commentedThe code looks promising, and would probably also fix #151861: Enable logging and a Whois block showing previous lookups.
You should be able to update this to apply to the latest cvs with only minor adjustments.
Comment #3
Greg Go commentedAdded a setting for logging / not logging cached lookups.
Rerolled the patches against DRUPAL-6--1 and HEAD. I'm not sure I did this right... first time submitting. Also, the D7 version is untested since I don't have a D7 install ready to go.
I think I can tackle the other issue too by pulling from the watchdog table but one thing at a time.
Comment #4
helmo commentedI adapted the patch a little bit.
* Only cache if no error occured
* include phpwhois lib for the Util class
* Include "(cached)" in the watchdog line when serving a cached result
* show the cache date
What do you think?
Comment #5
Greg Go commentedIt looks good!
The only problem I see was a comment I left in the settings -- "Log available as a block or a table at admin/reports/whois." I took that out since we haven't added that functionality in yet. Re-rolled.
Comment #6
helmo commentedThanks,
I just committed to DRUPAL-6--1 and HEAD.
Some thoughts for the future... maybe a refresh button or 'don't use cache' checkbox might come in handy for some people.