This regards CMSMS 1.11.11
I have noticed that in ContentOperations::LoadContentFromId() that if the content is found in the cache, then the loadproperties flag is ignored and the cached content is returned as is.
This is a problem if the cached content was loaded without properties but is now being requested with them.
Locally I've modified the code to reject the cache entry in this case and to fall through and load the content. This seems pretty inefficient, but there is no public API in ContentBase for loading properties into the cached object.
Or am I missing something here?
-jim
LoadContentFromId(), cache, and properties.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: LoadContentFromId(), cache, and properties.
The public method GetPropertyValue() will lazy load the properties for the content object if they are not already loaded.
Generally we try to discourage loading all of the properties for all of the requested content pages in one request. This is because people tend to 'over use' content blocks and properties, therefore it gets very memory intensive once the number of pages get large.
Generally we try to discourage loading all of the properties for all of the requested content pages in one request. This is because people tend to 'over use' content blocks and properties, therefore it gets very memory intensive once the number of pages get large.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: LoadContentFromId(), cache, and properties.
Ok. But Properties() does not do the load.
So if I have a Content object that I've gotten with LoadContentFromID() for which I want the properties as an array (to pass to a template, for instance) I could call HasProperty("") to load them as a side-effect, then call Properties() and not have to worry about fixing the bug locally.
-jim
So if I have a Content object that I've gotten with LoadContentFromID() for which I want the properties as an array (to pass to a template, for instance) I could call HasProperty("") to load them as a side-effect, then call Properties() and not have to worry about fixing the bug locally.
-jim
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: LoadContentFromId(), cache, and properties.
Yes. But just for safety purposes, you should pass in a property name (even if its an invalid one) to trigger the loading.
$mycontent_obj->HasProperty('__%%foo%%__');
return $mycontent_obj->Properties();
$mycontent_obj->HasProperty('__%%foo%%__');
return $mycontent_obj->Properties();
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.