Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: $customFields cached

Status Resolved
Add-on / Version Publisher 3.1.5
Severity
EE Version 5.3.2

Hop Studios

Sep 16, 2020

Hello Brian,

Ran into an issue… I have this page that has 2 {exp:channel:entries} calling 2 different entry_ids in the same channel to build the page. It looks like the second one is being affected by the first call. I had to remove line 169 to 171 from the FieldSchema.php so that the fields can be re-generated.
Publisher caching is turned off in the Cache Settings.

#1

BoldMinded (Brian)

Sep 16, 2020

What is the $cacheKey and $channels value for each iteration?

#2

Hop Studios

Sep 16, 2020

Both $cacheKey = ‘fieldSchema/tables/’;
Both $channels = ‘’;
I’m using entry_id=’{something}’; to get the exact entry.

#3

BoldMinded (Brian)

Sep 16, 2020

As long as the cache key is the same, the result should be the same. I don’t understand how the first entries tag is messing up the second one.

#4

Hop Studios

Sep 16, 2020

I think I found the issues. There are other calls that are on the page without channel=”“. And they all get the same cacheKey so one of them affected the entry loop that I’m having problem outputting. Adding channel=“pages” solved the problem.

Do you think it would be a better to fetch the channel of the entries if not passed in to make sure the cacheKey is built properly for each channel?

#5

BoldMinded (Brian)

Sep 30, 2020

What if you change line 169 to this?

if ($this->getChannelFilter() && ($customFields = $this->requestCache->get($cacheKey))) {
            return $customFields;
        }

Basically it should only use the cached response if a channel was defined.

#6

Hop Studios

Sep 30, 2020

It does fixed the issue. I’ve been using

if (!empty($channels) && $customFields = $this->requestCache->get($cacheKey)) {
    return $customFields;
}

I don’t know which option is more efficient.

#7

BoldMinded (Brian)

Sep 30, 2020

That might be a slightly more optimized. I’ll switch my repo to that. Thanks for verifying!

Login to reply