Reviewed & tested by the community
Project:
Entity API
Version:
7.x-1.x-dev
Component:
Entity property wrapper
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Nov 2011 at 09:01 UTC
Updated:
25 Nov 2018 at 07:36 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
fagoBut clear() only gets called when something is changed? So it won't be cleared automatically? Perhaps we should just add a public reset() method for clearing caches?
Afaik, the problem is 5.2 only. So upgrading to 5.3 should solve it too.
Comment #2
amitaibu> But clear() only gets called when something is changed?
Indeed, in my script I had to manually call it. We can't add it into __destructor() as it won't be called (chicken & egg)
Comment #3
fubhy commentedPatch works... It's up to fago to decide whether we want to implement it like this. However, if we choose to use this patch we should remove the trailing whitespaces in the first two lines of the comment :).
Comment #4
fagoHm, if we do that I don't think the cache would help a lot. Anyway, I've been thinking whether it's necessary to have that kind of cache at all. Maybe we should do some benchmarks on it, e.g. with using some Rules and other common access patterns?
Comment #5
fagoReasons for removing the cache:
Comment #6
alemadleiThis thread is quite old, but I'm interested if there was any discussion regarding this.
I'm experiencing this problem where using entity_metadata_wrapper on around 200000 items is using too much memory. I had to break down into smaller pieces by separate process in order to keep memory in check.
I will try the patch, but I would really appreciate if someone could point me to an update on this. Using version 7.x-1.6 on my site.
Regards,
Comment #7
joelpittetpublic reset() would be nice. I noticed after a commerce_order save that the cache was stale on the EMW.
Comment #8
joelpittetdatawas correct butcachewas stale on the number ofcommerce_line_itemsfield items on the order.Comment #9
joelpittetYup adding a reset() and clearing the cache fixes my issue.
Comment #10
joelpittetI just put the patch up to test something out but I'm a big +1 to #5
Comment #11
Scott Robertson commentedGoing to RTBC this as I ran into similar caching issues with EMW. This was in PHP 5.6, so not just a problem in 5.2.
If there are no plans to remove the cache as mentioned in #5, this patch at least makes it possible to manually clear the cache when you're having problems.
Comment #12
fagoYep, adding a public reset is fine, however this patch also adds the reset we do not want / can do without performance benchmarks. So setting to needs work.
Comment #13
Chris CharltonFWIW, I still desire this feature.
Comment #14
mpaler commentedHere's the patch with the modification recommended by fago.
Comment #15
joelpittetThat's a bit of progress on the issue, I'll take it.