--- tagadelic/tagadelic.module  2008-02-27 16:32:05.000000000 +0100
+++ tagadelic.module    2008-03-02 11:21:08.000000000 +0100
@@ -95,6 +95,14 @@
     '#default_value' => variable_get('tagadelic_levels', 6),
     '#description' => t('The number of levels between the least popular tags and the most popular ones. Different levels will be assigned a different class to be themed in tagadelic.css'),
   );
+  $options = array('CACHE_PERMANENT' => t('permanent'), 'CACHE_TEMPORARY' => t('temporary'));
+  $form['tagadelic_cachetype'] = array(
+    '#type' => 'radios',
+    '#title' => t('Tagadelic cache'),
+    '#options' => $options,
+    '#default_value' => variable_get('tagadelic_cachetype', 'CACHE_PERMANENT'),
+    '#description' => t('Determines where tagadelic caches its tagcloud'),
+  );
   return system_settings_form($form);
 }
 
@@ -214,9 +222,11 @@
   // Check if the cache exists
   $cache_name = 'tagadelic_cache_'. $options;
   $cache = cache_get($cache_name);
-  
+ 
+  $cache_place = variable_get('tagadelic_cachetype', CACHE_PERMANENT);
+ 
   // make sure cache has data
-  if (isset($cache->data)) {
+  if ((isset($cache->data)) && ($cache_place == 'CACHE_PERMANENT')) {
     $tags = $cache->data;
   }
   else {
@@ -227,8 +237,12 @@
     $result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid WHERE d.vid IN ('. substr(str_repeat('%d,', count($vids)), 0, -1) .') GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', $vids, 0, $size);
     
     $tags = tagadelic_build_weighted_tags($result, $steps);
-
-    cache_set($cache_name, $tags);
+    if ($cache_place == 'CACHE_TEMPORARY') {
+      cache_set($cache_name, $tags, 'cache_page', CACHE_TEMPORARY);
+    } 
+    else {
+      cache_set($cache_name, $tags, 'cache', CACHE_PERMANENT);
+    }
   }
   
   return $tags;
