Ignore:
Timestamp:
Jun 1, 2006 7:42:53 AM (18 years ago)
Author:
scdev
Message:

Q - Finished integrating singleton methods into existing code. Renamed SessionCache? to Cache, and renamed methods in Cache and Prefs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0singleton/services/admins.php

    r132 r135  
    1111
    1212require_once 'codebase/lib/PageNumbers.inc.php';
    13 require_once 'codebase/lib/SessionCache.inc.php';
     13require_once 'codebase/lib/Cache.inc.php';
    1414require_once 'codebase/lib/FormValidator.inc.php';
    1515require_once 'codebase/lib/SortOrder.inc.php';
     
    3030$fv = new FormValidator();
    3131
    32 $cache =& SessionCache::getInstance();
     32$cache =& Cache::getInstance();
    3333
    3434// Instantiate a sorting object with the default sort and order. Add SQL for each column.
     
    7171if (getFormData('break_list_cache', false)) {
    7272    // Break the cache because we are changing the list data.
    73     $cache->breakCache($_SERVER['PHP_SELF']);
     73    $cache->delete($_SERVER['PHP_SELF']);
    7474}
    7575
     
    319319    $app =& App::getInstance();
    320320    $db =& DB::getInstance();
    321     $cache =& SessionCache::getInstance();
     321    $cache =& Cache::getInstance();
    322322   
    323323    $lock->select('admin_tbl', 'admin_id', $id);
     
    327327
    328328    // Break the cache because we are changing the list data.
    329     $cache->breakCache($_SERVER['PHP_SELF']);
     329    $cache->delete($_SERVER['PHP_SELF']);
    330330
    331331    // Get the information for this object.
     
    367367    $app =& App::getInstance();
    368368    $db =& DB::getInstance();
    369     $cache =& SessionCache::getInstance();
     369    $cache =& Cache::getInstance();
    370370   
    371371    // Break the cache because we are changing the list data.
    372     $cache->breakCache($_SERVER['PHP_SELF']);
     372    $cache->delete($_SERVER['PHP_SELF']);
    373373
    374374    // Insert record data.
     
    411411    $app =& App::getInstance();
    412412    $db =& DB::getInstance();
    413     $cache =& SessionCache::getInstance();
     413    $cache =& Cache::getInstance();
    414414   
    415415    $lock->select('admin_tbl', 'admin_id', $frm['admin_id']);
     
    419419
    420420    // Break the cache because we are changing the list data.
    421     $cache->breakCache($_SERVER['PHP_SELF']);
     421    $cache->delete($_SERVER['PHP_SELF']);
    422422
    423423    // If the userpass is left blank or with the filler **** characters, we don't want to update it.
     
    456456    $db =& DB::getInstance();
    457457    $prefs =& Prefs::getInstance();
    458     $cache =& SessionCache::getInstance();
     458    $cache =& Cache::getInstance();
    459459   
    460460    $where_clause = '';
     
    507507    // without knowing the hash.
    508508    $cache_hash = md5($sql . '|' . $page->total_items);
    509     if ($prefs->getValue('cache_hash', $_SERVER['PHP_SELF']) != $cache_hash) {
    510         $cache->breakCache($_SERVER['PHP_SELF']);
    511         $prefs->setValue('cache_hash', $cache_hash, $_SERVER['PHP_SELF']);
    512     }
    513 
    514     if ($cache->isCached($_SERVER['PHP_SELF']) && false) {
     509    if ($prefs->get('cache_hash', $_SERVER['PHP_SELF']) != $cache_hash) {
     510        $cache->delete($_SERVER['PHP_SELF']);
     511        $prefs->set('cache_hash', $cache_hash, $_SERVER['PHP_SELF']);
     512    }
     513
     514    if ($cache->exists($_SERVER['PHP_SELF']) && false) {
    515515        // Get the cached results.
    516         $list = $cache->getCache($_SERVER['PHP_SELF']);
     516        $list = $cache->get($_SERVER['PHP_SELF']);
    517517    } else {
    518518        // If the list is not already cached, query now.
     
    525525        if (isset($list) && !empty($list)) {
    526526            // Cache the results.
    527             $cache->putCache($list, $_SERVER['PHP_SELF']);
     527            $cache->set($list, $_SERVER['PHP_SELF']);
    528528        }
    529529    }
Note: See TracChangeset for help on using the changeset viewer.