django-cachalot
django-cachalot copied to clipboard
Add a setting for enabling iterator caching
Fixes https://github.com/noripyt/django-cachalot/issues/256
Description
This adds a setting to enable caching query results when they're generators.
Rationale
Caching iterators causes OOM errors as documented in #256 when using QuerySet.iterator for large result sets because of list coercion.
I defaulted this setting to False since I think that's less surprising behavior, but this does change the existing behavior, so it would be a breaking change. Let me know if I should invert it to cache iterators by default as it currently does.
@Andrew-Chen-Wang Thoughts on this?
Gentle bump - any updates on this?
lgtm thank you
thx for this. I don't think it's a breaking change albeit a changing behavior. As they say, don't add performance improvements until you notice performance hits. If people notice a slowdown, I'm sure they can check the CHANGELOG to see this change and re-enable the setting.
hi this should be included in the new version (coming in an hour or two); i've reverted it to True again FYI, so you'll need to have it set to False.