Cache problem

bemari

New Member
Hi,

I'm seeing some weird stuff when cache is on. I use pre-filter to filter the list data based on username. I use {$my->username}.
It works great when cache is off but when enabled, I always get the data for the previous user which logged in.

So, if the last user which logged in was demo1, demo2 would see data belonging to username demo1.
Clearing the cache will fix it temporarily until the next user logs in.

Any idea what is going on?

Cache settings are: Conservative, File, 1min. Joomla 2.5.9, fabrik updated from Github 2 days ago.

br, Esa
 
Hmmmm. Now that is odd, because we very specifically include the logged on user id in our cache id in the list controller display() method:

PHP:
		$user = JFactory::getUser();
		$cacheid = serialize(array($uri, $input->post, $user->get('id'), get_class($view), 'display', $this->cacheId));

As you can see, we clearly use $user->get('id') in the cacheid, which we then use in the J! cache call to get our list view:

PHP:
			$cache->get($view, 'display', $cacheid);

So J!'s caching should absolutely not return a cached result, because the $cacheid will be different.

I was going to say you may just have to disable caching on that list, but I just noticed I only added that option (per-list setting to disable J! caching) in 2.1, after we forked 3.0, and it never made it into 3.0.

I think it's a necessary option, as there are some corner cases where a list should not be cached, ever, so I think I'll add that feature to 3.0 now.

It's not a "solution" to your problem, but will provide a bandaid until we can track down what's going on.

If I haven't responded here, or you don't see an obvious fix in the github commit widget over ==> there in the next 24 hours, bump and remind me.

-- hugh
 
OK, I added the per-list J! cache disabling option. Note that although the option is set on the List (under Advanced), it applies to the associated form view as well.

Let me know if this "fixes" your problem.

-- hugh
 
Thanks Hugh,

I updated from Github, set the Caching to conservative in Global config and set the Disable caching to Yes for the list.

Unfortunately, it didn't help and I'm still having the same issue. Everything works fine again after I disable the caching from Global configuration.

br, Esa
 
I'm unable to replicate this one.

What exact cache settings are you using?
Do you have the system cache plugin enabled as well?
How are you applying the prefilter - is it in the list's main settings or as part of the menu item settings?
 
Thanks Rob,

Cache settings were in the first post: Cache settings are: Conservative, File, 1min. Joomla 2.5.9.
System cache is enabled.
Pre-filter is actually in both places in menu item and lists main settings.

br, Esa
 
Do you have "Use browser caching" on or off in the System Cache plugin?

What happens if you disable the plugin, but leave basic J! caching enabled?

-- hugh
 
Oh, and are you running any third party extensions or plugins which provide alternative caching, or "fine grain" control of the built in caching, like CacheControl, etc?

-- hugh
 
Thanks Hugh,

"Use browser caching" was set to No in System-cache. I activated it and same result. Then, System-cache was disabled and the result was the same. Your "list cache" was set on in those tests.

Just standard Joomla 2.5.9, no additional plug-ings.
But, template I'm using is using their own cache system. I disabled those as well and same result. I still get items belonging to a wrong user.

It might be easiest if I would share my screen using Skype and you could see yourself what is happening.

br, Esa
 
Did you clear all Joomla cache after disabling the template caching?
What are your session settings?
Did you disable browser cookies?
 
Thanks guys,

I think I'm starting to get closer to the problem.
What if my list has a dropdown filter as one of the seach items for the list? I have a feeling userid is not used in this case when read from cache and values belonging to previous user are shown in dropdown field.

I can see now 2 separate cache files for the list items (1 for both users), but only 1 for the dropdown. The dropdown cache file is for the first user who logged in and also shown to the second user.

Does this make sense?

br, Esa
 
Just to clear up one thing, so I make sure I'm testing the same setup. In your original post, you said:

I use pre-filter to filter the list data based on username. I use {$my->username}

How is the element you are filtering on set up? Usually when we filter on per-user, we filter on {$my->id}, against a 'user' element.

Note that Troester has discovered something weird going on, a potential issue with J! itself, which may or may not have something to do with this. We're obviously concerned about any issue which might show "other people's" data, so we are working hard on resolving this. It's just a case of getting to the point where we can reliably duplicate the effects you are seeing.

I have some other work I absolutely have to get done today, but am hoping I'll get some time tonight to dedicate to this issue.

-- hugh
 
Correct, for the list I use {$my->username} pre-filter.
Then, one of the list list elements, "file", Filter is set as dropdown.

What I'm seeing now is that the data is correct in the list, but the dropdown has wrong values belonging to wrong user.

Send me a PM and we can connect via Skype and I can show what is happening.

Esa
 
My Skype is public (see to the left of any of my posts). It's 'cheesegrits'. I'm the only "Hugh" that should show up when you search for that.

Remember to include your forum name, or some reference to Fabrik, when you send your contact request.

-- hugh
 
BTW, my question was actually about how your username field is set up. Like, how do you get the username in to it when you create a new row. Is it done with an eval'ed default?

And, on a related note, why use 'username' rather than 'id'? J! usernames can change, thereby messing up any existing relationships or filtering. User ID's can't change. Not related (probably) to the issue at hand, just an observation.

-- hugh
 
OK, seems to be something deeply weird about the Gavick template / framework, and the additional caching it does. Even if you turn off GK's caching, the problem still happens in the GK template. if I switch the site to Beez2, it works fine.

I've worked round the problem by tweaking some of our cache code, to explicitly disable some of our additional caching if the List is set to "Disable Caching". Which is no bad thing, and probably needed doing anyway.

Works on his site. Will test changes locally, and wait for feedback from OP, before committing to github.

-- hugh
 
THANKS Hugh for your help.
I tested the change and now it works fine,

Thanks again for great support.

Esa
 
How did the testing with GK's caching go?

In other words, does it now work with the system plugin and GK caching enabled?

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top