You are here

function boost_db_prep in Boost 6

Figure out what is going in the database & put it in

Parameters

$filename: Name of cached file; primary key in database

$extension: Filename extension: Used for content types.

$expire: Cache expiration time in seconds (UNIX time).

1 call to boost_db_prep()
boost_cache_set in ./boost.module
Replaces/Sets the cached contents of the specified page, if stale.

File

./boost.module, line 4092
Provides static file caching for Drupal text output. Pages, Feeds, ect...

Code

function boost_db_prep($filename, $extension, $expire) {
  $router_item = _boost_get_menu_router();
  $timer = timer_read('page');
  $timer_average = $timer;
  $lifetime = -1;
  $push = -1;
  $settings = boost_get_settings_db($router_item);
  foreach ($settings as $value) {
    if ($value != NULL) {
      $boost_settings_db = $value;
      break;
    }
  }
  $boost_db = boost_get_db($filename);

  //get time data from actual entry, if this page has been cached before.
  if ($boost_db) {

    //  $expire = $boost_db['lifetime'] != -1 ? $boost_db['lifetime'] + BOOST_TIME : $expire;
    //  $lifetime = $boost_db['lifetime'];
    //  $push = $boost_db['push'];
    $timer_average = ($boost_db['timer_average'] + $timer) / 2;
  }

  //get data from settings table, if this page has not been put into the cache.
  if (isset($boost_settings_db)) {
    $expire = $boost_settings_db['lifetime'] != -1 ? $boost_settings_db['lifetime'] + BOOST_TIME : $expire;
    $lifetime = $boost_settings_db['lifetime'];
    $push = $boost_settings_db['push'];
  }
  boost_put_db($filename, $expire, $lifetime, $push, $router_item, $timer, $timer_average, $extension);
}