development

Conservation Strategy Fund Uses Drupal

Conservation Strategy Fund (CSF) recently launched their new Drupal website and the HydroCalculator Tool, both by CivicActions.  CSF's mission is to teach environmental organizations around the world to use economics and strategic analysis to conserve nature.  Their new website empowers them to do this with multi-lingual features, news streams and feeds, listings that can be filtered by continent, region, country or theme, t

Drupal Gotchya: Cache_get() Returns Expired Items

cache_get() returns $cache objects even if the cached item is stale (expired). The cached data will not be rebuilt every hour in the following example:

<?php
/**
* Builds complicated data for the monkey grip.
*/
function custom_monkey_grip_data() {
 
// Return the cached data
 
$cache = cache_get('custom:monkey_grip');
  if (!
$cache) {
   
// Some expensive processing to build the data.
   
$data = complicated_recursion_and_loops_on_lots_of_data();
   
   
// Cache the data and rebuild it every hour
   
$expire = time() + (60 * 60);
   
cache_set('custom:monkey_grip', $data, 'cache', $expire);
  }
  else {
   
$data = $cache->data;
  }
  return
$data;
}
?>

read more

Syndicate content