Just cache $this->params['paging'] after initialize paginator
then read it

that's all!!

for example:

if(empty($query)){
                                        $query = $this->paginate('Model');
                                        
$this->myCache->cacheQuery('paginator_'.$p,$this-
>params['paging'],array('duration'=>7200,'config'=>null));
                                        $this->myCache->cacheQuery($queryname,
$query,array('duration'=>7200,'config'=>null));
                                }else{
                                        $this->params['paging'] = 
$this->myCache->readQuery('paginator_'.
$p);
                                }

On 8月4日, 上午9時49分, bcyde <[EMAIL PROTECTED]> wrote:
> I was just wondering what the best approach to using data caching with
> the paginator helper.
>
> I'm doing something like this:
>
> $iPage = (isset($this->passedArgs['page']) && 
> intval($this->passedArgs['page']) ) ? $this->passedArgs['page'] : 1;
>
>                 $this->paginate = array(
>                                         'limit' => 20,
>                                         'page' => $iPage,
>                                         'order' => array('Item.create_date' 
> => 'DESC')
>                                 );
>
>                 $arrItems = Cache::read("items_index_{$iPage}");
>                 if ($arrItems === FALSE)
>                 {
>                         $arrItems = $this->paginate('Item', array() );
>                         Cache::write("items_index_{$iPage}", $arrItems,
> TFM_DATA_CACHE_TIMEOUT);
>                 }
>                 $this->set('items', $arrItems);
>
> Which works for the data, however when the cache is used the paginator
> is not initialized for displaying the page count, page numbers, etc.
> Is it possible to cache the paginator object in the controller to
> match with the data and then set that for the view?
>
> Thanks,
> -b

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to