Changeset 28432


Ignore:
Timestamp:
May 11, 2014, 10:26:41 AM (10 years ago)
Author:
rvelices
Message:

added a persistent cache mechanism; used so far to cache image ids in flat view mode

Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/maintenance.php

    r26461 r28432  
    147147    $template->delete_compiled_templates();
    148148    FileCombiner::clear_combined_files();
     149    $persistent_cache->purge(true);
    149150    break;
    150151  }
  • trunk/admin/plugins_installed.php

    r26461 r28432  
    7878      {
    7979        $template->delete_compiled_templates();
     80        $persistent_cache->purge(true);
    8081      }
    8182      redirect($base_url);
  • trunk/include/common.inc.php

    r27152 r28432  
    104104include(PHPWG_ROOT_PATH . 'include/functions.inc.php');
    105105
     106$persistent_cache = new PersistentFileCache();
    106107
    107108// Database connection
  • trunk/include/functions.inc.php

    r28171 r28432  
    3838include_once( PHPWG_ROOT_PATH .'include/derivative.inc.php');
    3939include_once( PHPWG_ROOT_PATH .'include/template.class.php');
     40include_once( PHPWG_ROOT_PATH .'include/cache.class.php');
    4041
    4142
  • trunk/include/section_init.inc.php

    r28320 r28432  
    292292      else
    293293      {
     294        $cache_key = $persistent_cache->make_key('all_iids'.$user['id'].$user['cache_update_time'].$conf['order_by']);
    294295        unset($page['is_homepage']);
    295296        $where_sql = '1=1';
     
    302303    }
    303304
    304     // main query
    305     $query = '
     305    if ( !isset($cache_key) || !$persistent_cache->get($cache_key, $page['items']))
     306    {
     307      // main query
     308      $query = '
    306309SELECT DISTINCT(image_id)
    307310  FROM '.IMAGE_CATEGORY_TABLE.'
     
    313316;';
    314317
    315     $page['items'] = query2array($query,null, 'image_id');
     318      $page['items'] = query2array($query,null, 'image_id');
     319     
     320      if ( isset($cache_key) )
     321        $persistent_cache->set($cache_key, $page['items']);
     322    }
    316323  }
    317324}
Note: See TracChangeset for help on using the changeset viewer.