Changeset 9926

Show
Ignore:
Timestamp:
11/14/08 09:08:02 (2 months ago)
Author:
afz
Message:

enhance caching in Poll gadget

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/0.8/jaws/html/gadgets/Poll/AdminModel.php

    r9920 r9926  
    136136 
    137137        //remove cached files 
    138         $GLOBALS['app']->Cache->delete('Poll'); 
     138        $GLOBALS['app']->Cache->delete('Poll', 'LastPoll'); 
     139        $GLOBALS['app']->Cache->delete('Poll', 'ListOfPolls'); 
    139140 
    140141        $GLOBALS['app']->Session->PushLastResponse(_t('POLL_POLLS_ADDED'), RESPONSE_NOTICE); 
     
    186187 
    187188        //remove cached files 
    188         $GLOBALS['app']->Cache->delete('Poll'); 
     189        $GLOBALS['app']->Cache->delete('Poll', 'LastPoll'); 
     190        $GLOBALS['app']->Cache->delete('Poll', 'ListOfPolls'); 
     191        $GLOBALS['app']->Cache->delete('Poll', 'ViewPoll', $pid); 
     192        $GLOBALS['app']->Cache->delete('Poll', 'ViewResult', $pid); 
    189193 
    190194        $GLOBALS['app']->Session->PushLastResponse(_t('POLL_POLLS_UPDATED'), RESPONSE_NOTICE); 
     
    209213 
    210214        //remove cached files 
    211         $GLOBALS['app']->Cache->delete('Poll'); 
     215        $GLOBALS['app']->Cache->delete('Poll', 'LastPoll'); 
     216        $GLOBALS['app']->Cache->delete('Poll', 'ListOfPolls'); 
     217        $GLOBALS['app']->Cache->delete('Poll', 'ViewPoll', $pid); 
     218        $GLOBALS['app']->Cache->delete('Poll', 'ViewResult', $pid); 
    212219 
    213220        $sql = 'DELETE FROM [[poll_answers]] WHERE [pid] = {pid}'; 
     
    305312 
    306313        //remove cached files 
    307         $GLOBALS['app']->Cache->delete('Poll'); 
     314        $GLOBALS['app']->Cache->delete('Poll', 'LastPoll'); 
     315        $GLOBALS['app']->Cache->delete('Poll', 'ViewPoll', $pid); 
     316        $GLOBALS['app']->Cache->delete('Poll', 'ViewResult', $pid); 
    308317 
    309318        return true; 
     
    338347 
    339348        //remove cached files 
    340         $GLOBALS['app']->Cache->delete('Poll'); 
     349        $GLOBALS['app']->Cache->delete('Poll', 'LastPoll'); 
     350        $GLOBALS['app']->Cache->delete('Poll', 'ViewPoll', $pid); 
     351        $GLOBALS['app']->Cache->delete('Poll', 'ViewResult', $pid); 
    341352 
    342353        return true; 
     
    360371 
    361372        //remove cached files 
    362         $GLOBALS['app']->Cache->delete('Poll'); 
     373        $GLOBALS['app']->Cache->delete('Poll', 'LastPoll'); 
     374        $GLOBALS['app']->Cache->delete('Poll', 'ViewPoll', $pid); 
     375        $GLOBALS['app']->Cache->delete('Poll', 'ViewResult', $pid); 
    363376 
    364377        return true; 
  • branches/0.8/jaws/html/gadgets/Poll/HTML.php

    r9920 r9926  
    5656                    $model->AddAnswerVote($post['pid'], $aid); 
    5757                } 
     58 
     59                //remove cached files 
     60                $GLOBALS['app']->Cache->delete('Poll', 'ViewResult', $post['pid']); 
    5861            } 
    5962        } 
     
    104107        $request =& Jaws_Request::getInstance(); 
    105108        $pid = $request->get('id', 'get'); 
    106         return $layoutGadget->Display($pid); 
     109        return $layoutGadget->ViewPoll($pid); 
    107110    } 
    108111 
     
    115118    function ViewResult() 
    116119    { 
     120        //cache output of this action 
     121        $GLOBALS['app']->Layout->SetCurrentActionCacheable(); 
     122 
    117123        $request =& Jaws_Request::getInstance(); 
    118124        $pid = $request->get('id', 'get'); 
  • branches/0.8/jaws/html/gadgets/Poll/LayoutHTML.php

    r9920 r9926  
    3636        if (!Jaws_Error::isError($polls)) { 
    3737            foreach ($polls as $poll) { 
    38                 $actions['Display(' . $poll['id'] . ')'] = array( 
     38                $actions['ViewPoll(' . $poll['id'] . ')'] = array( 
    3939                    'mode' => 'LayoutAction', 
    4040                    'name' => $poll['question'], 
     
    5656    function LastPoll() 
    5757    { 
    58         return $this->Display(0); 
     58        return $this->ViewPoll(0); 
    5959    } 
    6060 
     
    9696     * @access  public 
    9797     */ 
    98     function Display($pid = 0) 
     98    function ViewPoll($pid = 0) 
    9999    { 
    100100        //cache output of this action