-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't cache a ReturnDict. #2360
Comments
Could you also include a concrete use case to work against. In get the question generally, but it'd be helpful to see the specific case you're trying to achieve. |
Also what error is raised? |
It seems that the ReturnDict having a link to the serializer breaks the pickling:
|
Note that Django uses pickle to cache things. |
@xordoquy Yes, that is the exact problem I am having (nested serializers). |
It was a bit late yesterday. I'll add a proper test case this evening. |
@xordoquy Is this a bug or was this the way DRF was designed? |
It's both ;) |
hahahaha nice :P |
Any luck? |
So the right way to resolve this would be either...
Or...
My personal take is that using pickle to deal with HTTP caching is a wonky approach. Rather store the raw headers and content, and return a newly created response instance when returning cached content. (Then you don't bump into all this horrible sorts of cases.) |
I encountered this problem (I think) when I was trying to set up caching On Mon, Jan 5, 2015 at 12:31 PM, Tom Christie [email protected]
Mark Chackerian VP Engineering, Architizer http://www.architizer.com/ |
I just encountered this issue as well while working on the upgrade. It also happens with a (Error lines: cPickle.c #L2100-2106)
|
Has anyone been able to cache
serializer.data
from a custom Serializer on one object? Seems like there's no way to store the ReturnDict that results fromserializer.data
.The text was updated successfully, but these errors were encountered: