[ISSUE] Issue with cache and category views.... [and a solution proposal]

More
8 years 8 months ago #61364 by fortino
Hi,

for many reasons I need different views of the same category.
Basically I've different filters in each view.
I just found out that cache is not working with these views and to me caching is the most important thing to improve performance.

The problem is in the front-end controller of the category: it just ignore all the params of the menu item so every view is cached in the same way.

I solved adding these lines:
Code:
/* SG MOD */ if ($menu) foreach($menu->params as $pluto => $paperino) if(!empty($paperino)) $safeurlparams[$pluto.(string)$paperino] = 'STRING'; /* END SG MOD */
after the line 1066 @  /components/com_flexicontent/controller.php

Please Log in or Create an account to join the conversation.

More
8 years 8 months ago #61368 by ggppdk
Hello

i understand the issue

but ... adding ALL parameters 1 by one ? !!

- even if the current menu item is not of current category but of ... some parent or if it is the component default menu item ?

beside we add all parameters, we can just add 1 thing,
Itemid , aka the ID of the menu item

New issue with v3.0.14 milestone
github.com/FLEXIcontent/flexicontent-cck/issues/522


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
8 years 8 months ago - 8 years 8 months ago #61377 by fortino
Nope, you're wrong,
that code add only the parameters that have some value, not every single paramater.
for what I know every parameter with a value has a specific purpose in the view... so I deicide to check every params and only the ones with a values will be put in the $safeurlparams array.

only the itemid wasn't working, I tried before this solution unsuccessfully.
Last edit: 8 years 8 months ago by fortino.

Please Log in or Create an account to join the conversation.

More
8 years 8 months ago #61380 by ggppdk
Hello

if adding Itemid is not working then stop and think what you are doing wrong
because it must be due to a mistake you made,

- if you have really added it properly then Joomla cache should create a different CACHED ID !
so you did not add it properly

by adding all parameters , you don't achieve anything more what Itemid would have achieved, and if you look in other components they do add the Itemid when needed

- but i agree that IF YOU TOOK the parameters FROM menu and NOT FROM category (which uses heritage), then propably there are much less in terms of numbers

As an example check our code to achieve different caching according to
- if client is mobile or not (ok Joomla 3.5.0 added this recently and it can be optionally enabled)
- and the code to force different cache for every logged user regardless of Joomla settings

anyway will test it, to add the Itemid properly
github.com/FLEXIcontent/flexicontent-cck/issues/522


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
8 years 8 months ago - 8 years 8 months ago #61383 by fortino
ok, you should know those are parameters from the menu item not the category AND I put only the ones with values ... in my case we're talking of 5/6 more values in the array.

BTW I appreciate your suggestions but let me understand this:

Why did you use this method if the itemid is enough? [line 1066 circa]
Code:
if ($menu) foreach($menu->query as $_varname => $_ignore) $safeurlparams[$_varname] = 'STRING';
I just used a solution "similar" to the solutions used before by the original developer, that's why I didn't search the cause of the itemid wasn't working.

[BTW the common developer use of the diplay method is to pass the parameters of the component, like you did with only a few of them, not the itemid... ]

ANYWAY:
It work with also this:
Code:
if ($menu) $safeurlparams[(string)$menu->id]='STRING';
instead my previous solution.

And this makes me ask why I shouldn't comment the original code and user something like this:
Code:
else { $safeurlparams = array(); $menu = JFactory::getApplication()->getMenu()->getActive(); // if ($menu) foreach($menu->query as $_varname => $_ignore) $safeurlparams[$_varname] = 'STRING'; if ($menu) $safeurlparams[(string)$menu->id]='STRING'; // Add any existing URL variables (=submitted via GET), ... we only need variable names, (so can use them unfiltered) foreach($_GET as $_varname => $_ignore) $safeurlparams[$_varname] = 'STRING'; }


All my questions , my topics and comments are here only for learning purpose and my love of the "open source community"... I'm not here to bug anyone...
Last edit: 8 years 8 months ago by fortino.

Please Log in or Create an account to join the conversation.

More
8 years 8 months ago - 8 years 8 months ago #61385 by ggppdk
Code:
if ($menu) foreach($menu->query as $_varname => $_ignore) $safeurlparams[$_varname] = 'STRING';

yes that is old and non-optimal code

if ($menu) $safeurlparams[(string)$menu->id]='STRING';
yes, the 2nd one is what we should have used in the 1st place

i thought we had done this, but i missed it,
- the existing code is wrong approach

the approach is simply wrong because it adds too much redundancy for almost no gain the chance of
- 2 category view menu items
- 2 item view menu items
- 2 tags view menu items

having the same parameters, is small thus we are adding more work (small but still a few milliseconds or maybe almost zero more) to the CACHE ID creation for no real benefit

will replace it !!


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 8 years 8 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.393 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline