List caching not implemented #373

Open
vesterbaek opened this Issue Feb 13, 2012 · 6 comments

Comments

Projects
None yet
4 participants
@vesterbaek

It seems tastypie is only caching individual objects, and not object
lists (where caching in my case would make most use):
https://github.com/toastdriven/django-tastypie/blob/master/tastypie/resources.py#L1026

@toastdriven

This comment has been minimized.

Show comment Hide comment
@toastdriven

toastdriven Feb 14, 2012

Contributor

The link points to a blank line as it currently stands on master. Perhaps you can link to the right line in a specific revision?

Contributor

toastdriven commented Feb 14, 2012

The link points to a blank line as it currently stands on master. Perhaps you can link to the right line in a specific revision?

@toastdriven

This comment has been minimized.

Show comment Hide comment
@toastdriven

toastdriven Feb 16, 2012

Contributor

The standard response, TBH, is that you're better served by putting Varnish in front of your API than implementing that caching. I left that comment there because there are a ton of variables in play at that point (GET params, auth, user-specific things, extensions, pagination, etc) & making sure caching happens correctly in all those circumstances for everyone is non-trivial.

When that comment was left there, it was trivial to override get_list to call the cached variant (https://github.com/toastdriven/django-tastypie/blob/dae495787f4397ff4fc6b245d060c676be910eb9/tastypie/resources.py#L897). As the codebase has grown, it's gotten less easy.

I'll still look into it, as there's definitely value in it, but you'd be better served by Varnish regardless.

Contributor

toastdriven commented Feb 16, 2012

The standard response, TBH, is that you're better served by putting Varnish in front of your API than implementing that caching. I left that comment there because there are a ton of variables in play at that point (GET params, auth, user-specific things, extensions, pagination, etc) & making sure caching happens correctly in all those circumstances for everyone is non-trivial.

When that comment was left there, it was trivial to override get_list to call the cached variant (https://github.com/toastdriven/django-tastypie/blob/dae495787f4397ff4fc6b245d060c676be910eb9/tastypie/resources.py#L897). As the codebase has grown, it's gotten less easy.

I'll still look into it, as there's definitely value in it, but you'd be better served by Varnish regardless.

@vesterbaek

This comment has been minimized.

Show comment Hide comment
@vesterbaek

vesterbaek Feb 17, 2012

Ok, I see the problems. I still think that implementing caching here is preferable in some situations, since it makes deployment a easier.

Ok, I see the problems. I still think that implementing caching here is preferable in some situations, since it makes deployment a easier.

@JesseAldridge

This comment has been minimized.

Show comment Hide comment
@JesseAldridge

JesseAldridge Apr 19, 2012

Might want to note this in the docs: http://stackoverflow.com/questions/10219743/why-doesnt-my-tastypie-cache-get-called

It would be nice if we could use a simple json cache like the one described in the docs -- that way I don't need to figure out how to set up Varnish and make it work with my current deployment.

Might want to note this in the docs: http://stackoverflow.com/questions/10219743/why-doesnt-my-tastypie-cache-get-called

It would be nice if we could use a simple json cache like the one described in the docs -- that way I don't need to figure out how to set up Varnish and make it work with my current deployment.

@jbasko

This comment has been minimized.

Show comment Hide comment
@jbasko

jbasko Mar 17, 2014

Yes, a comment in docs http://django-tastypie.readthedocs.org/en/latest/caching.html would have saved me an hour or so spent on finding that comment in Tastypie source that explained why cache didn't work.

jbasko commented Mar 17, 2014

Yes, a comment in docs http://django-tastypie.readthedocs.org/en/latest/caching.html would have saved me an hour or so spent on finding that comment in Tastypie source that explained why cache didn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment