I had a problem with views in panels where various overrides were being set. A view limited to just one entry was appearing on a page which was supposed to show ten items and a pager. I took a look at the get_results_key() function and the query that's cached is the same in both cases as at the time of getting the key no range has been set.

I amended this function to add an item to the $key_data array as follows:

        'items_per_page' => $this->view->items_per_page,

This fixed the immediate problem. I suspect there are other potential issues that it doesn't fix (I have also seen problems on large sites due to hash collisions, not sure what can be done about that.)

I haven't the time right now to submit a patch to D.o standards. Will do so when time permits.

Comments

colan’s picture

Tagging.

steven jones’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

So we're just using the cache key that views provides, so if this is an issue, then views needs to support it, not us.
But, a token look at the views code would suggest that actually views is already adding this to the cache key.

I'm closing this issue here, but if it's still an issue, then I'd suggest opening an issue on the views project asking to add the items per page to the cache key method on the default views cache plugin.

alfaguru’s picture

Thanks Steve, looks like when I made this report there was code (copied from views?) which has since been removed. So the issue hopefully no longer exists.

steven jones’s picture

Ah yes, sorry about that. Lovely stuff.

mgifford’s picture