Forums / Developer / How to build an update CLI script without memory problem ? / Comment55809
Bertrand Dunogier
Tuesday 17 November 2009 2:49:56 am
By the way, you don't need to run both unset ( $GLOBALS['eZContentObject*'] ) AND ezContentObject::clearCache().
What eZContentObject::clearCache() is the exact same thing: it clears these global vars, except for eZContentClassAttributeCache and eZUserCache. Since 4.2.0, you can use eZContentClassAttribute::clearCache() to clear $GLOBALS['eZContentClassAttributeCache'].
For both eZContentObject::clearCache() and eZContentClassAttribute::clearCache(), you can provide an object ID or array of object ID, and in-memory cache will only be cleared for these.
This will make this code a bit more portable, especially since it is most likely that in-memory cache will _ finally _ be refactored in a later version.
Bertrand Dunogier eZ Systems Engineering, Lyon http://twitter.com/bdunogier http://gplus.to/BertrandDunogier