[support] cached content even if in !$may_cache section (drupal 5)

Earnie Boyd earnie at users.sourceforge.net
Sun Apr 19 16:14:05 UTC 2009


Quoting Ivan Sergio Borgonovo <mail at webthatworks.it>:



> This is D5.

Yes, you said that before.

> And yeah even if the snippet didn't use a *form* there
> is a form involved in the real case.
>
> So let's make the snippet more complete and add the steps to
> reproduce the problem.
>
> /* hook_menu */
> if(!$may_cache) {

$may_cache only affects the items returned for the $menu.

>   $item[] = array(
>     'path' => 'some/path1',
>     'callback' => 'stuffthatchangedb',
>   );
>   $item[] = array(
>     'path' => 'some/path2',
>     'callback' => 'drupal_get_form',
>     'callback arguments' => array('stuffthatdependsondb'),
>   );

So the above will not be cached in the menu's cache.

> }
>
> function stuffthatchangedb() {
>   db_query('insert values(someid, somefield) values(default, 97);
>   drupal_goto('some/path2');
> }
>
> function stuffthatdependsondb() {
>   $result = db_query("select someid, somefield from table1;");
>   while($row = db_fetch_array($result)) {
>     $form['something'][$row['someid']] = array(
>       '#type' => 'textfield',
>       '#default_value" => $row['somefield'],
>     );
>   }
>   return $form;
> }
>
> I visit some/path1.
> some/path1 add a record to table1
> I get redirected to some/path2.
> I visit once more some/path1
> some/path1 add a record to table1
> some/path2 still show the content of the first time I visited it.
>

This has nothing to do with $menu_cache.  It has to do with your page  
cache or the browser cache since you have caching set to normal.   
Reduce the cache lifetime in settings.php.

--
Earnie
-- http://r-feed.com/           -- http://for-my-kids.com/
-- http://www.4offer.biz/       -- http://give-me-an-offer.com/




More information about the support mailing list