Should I submit a new module?
Hi! I found a recent need to be able to force clear the caches, but didn't want to install devel.module. I created a small module that just provides a menu item for clearing caches. (The scenario is that I have a page which is generated by the php filter; it wasn't being updated for anonymous users due to caching.) Is this something that other people would find useful? I would probably have the menu item be optional and use hook_form_alter to put a button on the performance settings page. If others are interested, I'll create a project on drupal.org and release it, but I wasn't certain if something already did this, or if people felt it just wasn't worth bothering with. Thanks, Ricky The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.
Yes, good idea. Devel is dangerous in the wrong hands. Clearing the cache is harmless (but may impact performance for a bit). Of course you can do it with phpmyadmin but that is also dangerous in unskilled hands. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Richard Morse Sent: Tuesday, June 05, 2007 2:37 PM To: development@drupal.org Subject: [development] Should I submit a new module? Hi! I found a recent need to be able to force clear the caches, but didn't want to install devel.module. I created a small module that just provides a menu item for clearing caches. (The scenario is that I have a page which is generated by the php filter; it wasn't being updated for anonymous users due to caching.) Is this something that other people would find useful? I would probably have the menu item be optional and use hook_form_alter to put a button on the performance settings page. If others are interested, I'll create a project on drupal.org and release it, but I wasn't certain if something already did this, or if people felt it just wasn't worth bothering with. Thanks, Ricky The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information. -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.9/832 - Release Date: 6/4/2007 6:43 PM
For such "mini" modules, I created a section of the snippets handbook a while back: http://drupal.org/node/70903 To me, it's not worth cluttering the download page and maintaining something that's only a few lines of code. However, they are about as useful as a page snippet and can provide a basis for others to customize. -Peter On 6/5/07, Walt Daniels <wdlists@optonline.net> wrote:
Yes, good idea. Devel is dangerous in the wrong hands. Clearing the cache is harmless (but may impact performance for a bit). Of course you can do it with phpmyadmin but that is also dangerous in unskilled hands.
-----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Richard Morse Sent: Tuesday, June 05, 2007 2:37 PM To: development@drupal.org Subject: [development] Should I submit a new module?
Hi! I found a recent need to be able to force clear the caches, but didn't want to install devel.module. I created a small module that just provides a menu item for clearing caches. (The scenario is that I have a page which is generated by the php filter; it wasn't being updated for anonymous users due to caching.)
Is this something that other people would find useful? I would probably have the menu item be optional and use hook_form_alter to put a button on the performance settings page.
If others are interested, I'll create a project on drupal.org and release it, but I wasn't certain if something already did this, or if people felt it just wasn't worth bothering with.
Thanks, Ricky
The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.
-- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.9/832 - Release Date: 6/4/2007 6:43 PM
Why not use "Minimum cache lifetime" (can be found in admin/settings/performance)? Stefan
Because "Minimum cache lifetime" keeps things in the cache for longer, and he wants to clear the cache. On 05/06/07, Stefan Borchert <stefan@borchert.cc> wrote:
Why not use "Minimum cache lifetime" (can be found in admin/settings/performance)?
Stefan
-- Regards Steven Jones
It's easy to write a tiny module that clears the cache using hook_cron. I had to do this so the even module block would update every 15 minutes regardless of whether new cotent was added. -Peter On 6/5/07, Steven Jones <darthsteven@gmail.com> wrote:
Because "Minimum cache lifetime" keeps things in the cache for longer, and he wants to clear the cache.
On 05/06/07, Stefan Borchert <stefan@borchert.cc> wrote:
Why not use "Minimum cache lifetime" (can be found in admin/settings/performance)?
Stefan
-- Regards Steven Jones
Steven Jones schrieb:
Because "Minimum cache lifetime" keeps things in the cache for longer,
Errm, no. <quote from admin/settings/performance> "The minimum cache lifetime is the minimum amount of time that will go by before the cache is emptied and recreated." </quote> If you set it to "10 min" the cache is cleared every ten minutes (on the next page request). greetings, Stefan
On 05/06/07, Stefan Borchert <stefan@borchert.cc> wrote:
Why not use "Minimum cache lifetime" (can be found in admin/settings/performance)?
So the cache is cleared indiscriminately of all data older than say 10 mins, even if I don't tell drupal to clear the cache (either by calling cache_clear_all or creating a node etc.)? This is surely a maximum cache life too then, i.e. should be called just "cache lifetime" On 06/06/07, Stefan Borchert <stefan@borchert.cc> wrote:
Steven Jones schrieb:
Because "Minimum cache lifetime" keeps things in the cache for longer,
Errm, no. <quote from admin/settings/performance> "The minimum cache lifetime is the minimum amount of time that will go by before the cache is emptied and recreated." </quote> If you set it to "10 min" the cache is cleared every ten minutes (on the next page request).
greetings,
Stefan
On 05/06/07, Stefan Borchert <stefan@borchert.cc> wrote:
Why not use "Minimum cache lifetime" (can be found in admin/settings/performance)?
-- Regards Steven Jones
On Wed, 06 Jun 2007 07:34:49 +0200 Stefan Borchert <stefan@borchert.cc> wrote:
Steven Jones schrieb:
Because "Minimum cache lifetime" keeps things in the cache for longer, Errm, no. <quote from admin/settings/performance> "The minimum cache lifetime is the minimum amount of time that will go by before the cache is emptied and recreated." </quote> If you set it to "10 min" the cache is cleared every ten minutes (on the next page request).
That is not correct. The minimum cache lifetime enforces exactly what the name says: a minimum cache lifetime. It simply ensures that the cache will not be flushed more frequently than the configured value. It does not enforce a maximum cache lifetime. Setting the minimum cache lifetime to 10 minutes does not cause the cache to be flushed every 10 minutes -- it means that there is a 10 minute delay between when Drupal requests that the cache be flushed and when it is actually flushed. (The idea being that if the cache is flushed each time a comment is posted, on a busy site like drupal.org this can lead to the cache being flushed too often to actually be used in serving pages to anonymous users.) ----- Digression about the current implementation, and how it could be easily improved: ----- I think the current implementation is not quite right. Currently it works as follows: Using your example of a minimum cache lifetime of "10 min": 1) the cache is flushed at 01:00:00 2) another cache flush event is requested at 01:01:14 (for example, a comment is posted) 3) the cache is not actually flushed until 01:11:14, ten minutes after the second cache flush request. That is, the current logic simply ads a delay between when the cache flush request was made, and when it is actually executed. It seems instead it would be better to track the last time the cache wash flushed, and simply be sure that the minimum cache lifetime has passed before flushing again. In that case, it would work as follows: 1) the cache is flushed at 01:00:00 2) another cache flush event is requested at 01:01:14 (for example, a comment is posted) 3) the cache is not actually flushed until 01:10:00, ten minutes after the last time the cache was flushed. (In a more exaggerated example to illustrate why I think the current implementation is wrong: 1) the cache is flushed at 01:00:00 2) another cache flush event is requested at 02:45:10 3) the cache is not actually flushed until 02:55:10 -- this added 10 minute delay is silly at this point as the cache already lived 2 hours and 45 minutes. It should instead be immediately flushed at that point.) Cheers, -Jeremy
On Jun 5, 2007, at 3:04 PM, Stefan Borchert wrote:
Why not use "Minimum cache lifetime" (can be found in admin/ settings/performance)?
In this particular case, the cache wouldn't have been determined to be invalid by Drupal. This page is a listing of all the users, with some of their profile data. I'm not using my module site_user_list because at the time I set this site up, site_user_list couldn't do what I wanted, and with only ~20 users involved, I don't mind running user_load on each user; especially since only two users can actually log in, so everything is being set up for anonymous users. When I added a user, Drupal doesn't know that this is going to change the display of the page, so it doesn't invalidate the cache. So I need a way to force the cache to be emptied. However, I think I may have an even better solution -- I had forgotten the idea of a PHP page (which is stupid on my part, given that this problem was caused by such a page). So I could create a page which runs the cache clearing code without the need for a module. I'll try to put something up in the PHP snippets section shortly about this. Thanks, Ricky The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.
participants (6)
-
Jeremy Andrews -
Peter Wolanin -
Richard Morse -
Stefan Borchert -
Steven Jones -
Walt Daniels