Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 937179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:26:07+00:00 2026-05-15T21:26:07+00:00

Using Zend Paginator and the paginator cache works fine, but the same cached pages

  • 0

Using Zend Paginator and the paginator cache works fine, but the same cached pages are returned for everything. Ie. I first look at a list of articles, when i go to view the categories the articles list is returned. How can I tell the paginator which result set i am looking for?

Also, how can I clear the paginated results without re-querying the paginator. Ie. I am updated a news article therefore the pagination needs to be cleared.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:26:07+00:00Added an answer on May 15, 2026 at 9:26 pm

    Zend_Paginator uses two methods to define cache ID: _getCacheId and _getCacheInternalId. Second function is calculating cache ID based on two parameters: the number of items per page and special hash of the adapter object. The first function (_getCacheId) is calculating cache ID using result from _getCacheInternalId and current page.

    So, if you are using two different paginator objects with 3 same internal parameters: adapter, current page number and the number of items per page, then your cache ID will be the same for these two objects.

    So the only way I see is to define you own paginator class inherited from Zend_Paginator and to re-define one of these two internal functions to add a salt to cache ID.
    Something like this:

    class My_Paginator extends Zend_Paginator {
    
        protected $_cacheSalt = '';
    
        public static function factory($data, $adapter = self::INTERNAL_ADAPTER, array $prefixPaths = null) {
        $paginator = parent::factory($data, $adapter, $prefixPaths);
        return new self($paginator->getAdapter());
    }
    
        public function setCacheSalt($salt) {
            $this->_cacheSalt = $salt;
            return $this;
        }
    
        public function getCacheSalt() {
            return $this->_cacheSalt;
        }
    
        protected function _getCacheId($page = null) {
            $cacheSalt = $this->getCacheSalt();
            if ($cacheSalt != '') {
                $cacheSalt = '_' . $cacheSalt;
            }
            return parent::_getCacheId($page) . $cacheSalt;
        }
    }
    
    $articlesPaginator = My_Paginator::factory($articlesSelect, 'DbSelect');
    $articlesPaginator->setCacheSalt('articles');
    
    $categoriesSelect = My_Paginator::factory($categoriesSelect, 'DbSelect');
    $articlesPaginator->setCacheSalt('categories');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I started using Zend_Paginator, it works everything fine but I noticed that there is
i am using zend paginator in my app.pagination works well but i get this
I am using Zend Dom component to parse some Html blocks, but i have
i am using zend paginator for pagination in my app here is the action
I'm using Zend Paginator here, in an ajax request I am retrieving objects based
I am using zend paginator. I am getting following structure by using $this->paginator: (
so I'm currently using Zend Paginator because I'm having the impression that it doesn't
I was looking at Zend_Paginator in Zend Framework project using MVC, and it looks
Can someone help me achieve multiple zend pagination in a view using ajax. I
Using Zend Framework, I've created a Model to insert a record into a database.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.