Caching is a good thing generally, but there is no option in the Flickr API module to completely disable caching. I can think of a few situations where this can be useful:
- testing
- where the site owner is concerned about the security of their private Flickr photos on, say, a shared server
- to save on bandwidth, using Flickr's instead :)
Note that disabling caching is inadvisable in at least one call I've seen, where Flickr ask API users not to invoke it more than once per hour. The other "activity" method, activity.userComments has the same restriction now I check.
I also notice that phpFlickr, the excellent library used by this module, has two kinds of caching: database and file system. "fs" is currently hardcoded. Support for "db" could be easily added if site owners find the choice useful.
I have a patch for disabling caching, to follow attached to the first comment.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | nocache-1320198-1.patch | 4.44 KB | hughbris |
Comments
Comment #1
hughbris commented[This the second of 4 discreet patches/fixed issues I made about a week ago which I am only just getting time to post]
This patch allows caching to be disabled. It puts cache settings into a fieldset in the module settings form (flickrapi_admin_settings), which is shown in collapsed view when caching is off. It amends the instantiation of the phpFlickr class to bypass the enableCache method when flickrapi_cache_enabled, the new setting, is false.
There is a known issue with this patch where I set the #required form property on the cache file path (
flickrcachepath) when the admin settings form is loaded. This will incorrectly cause validation errors if the caching is toggled off and a blank value is inflickrcachepath. What we really want is a conditional requirement. This could be accomplished with Javascript. However, a Javascript-only solution is not acceptable to me.I hoped to be able to toggle the #required property of
flickrcachepathafter form submission but before validation. I haven't been able to find an answer in documentation or by asking on IRC, but I suspect there might be an elegant way. If not, #required can just be set false and checked wholly within hook_validate(), and perhaps some Javascript can enhance the experience.Comment #2
hughbris commentedAs a placeholder, I'll add two more quick comments about caching in this module. The maintainer may consider them worthy of a separate bug report / feature request respectively:
flickrcachepathisn't named consistently using the underscore-ish conventions of the other admin settingsflickrcachepathis writeable, though arguably this should be implemented upstream in phpFlickr:)
Comment #3
BarisW commentedThanks for pointing this out. Will be fixed in 7.x first, then backported to 6.x.
Comment #4
BarisW commentedBy the way, your two suggestions in #2 have already been fixed in the D6 & D7 version.
Comment #5
BarisW commentedCommitted. Thanks!
Comment #6.0
(not verified) commentedclarified cache type explanation