Skip to content
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

Cacheback templatetag #71

Open
mitchelljkotler opened this issue Dec 18, 2016 · 3 comments
Open

Cacheback templatetag #71

mitchelljkotler opened this issue Dec 18, 2016 · 3 comments

Comments

@mitchelljkotler
Copy link

I would like a general purpose cacheback template tag that functions the same as the builtin cache template tag except uses cacheback to update the cache asynchronously. I started a branch to implement such a tag, but there is a major problem of serializing the context to send to celery to process. I cannot get it to serialize with cPickle at all and with regular pickle it took ~30 seconds which is clearly unacceptable and would require some sort of custom serializer to use pickle instead of cPickle. Does anybody have any ideas how we can serialize the request context to celery in a reasonable amount of time?

@stephrdev
Copy link
Collaborator

I'm not sure if passing serializing the whole context can be done easily or fast enough.

@mitchelljkotler
Copy link
Author

I agree - I am currently working on an implementation that passes just the original environment (which is easily serializable) to celery, which then triggers an entire page re-render in order to update the cache with the new values. This is obviously tricky and has potential to not play nicely with other apps, and can only be done for GET requests.

I was also thinking about an implementation where you also pass in the context keys that need to be copied (or try to derive it automatically from the template parser) and only serialize that part of the context. I haven't tried this approach yet.

@stephrdev
Copy link
Collaborator

Sounds complex to me. Feel free to build an proof of concept but I'm really not sure if this should land in cacheback. Maybe an extra library built up on cacheback?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants