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

Cache public site pages and Apply homepage #1160

Merged
merged 6 commits into from
Apr 26, 2019
Merged

Conversation

Parbhat
Copy link
Contributor

@Parbhat Parbhat commented Apr 15, 2019

Cache for the public site and apply homepage can be invalidated from settings > cache in Wagtail admin. The cache will also be invalidated automatically when a wagtail page is edited/created. The cache will not work for logged in users. And WAGTAIL_CACHE should be set True in local.py settings while testing locally.

Also, remove the unused code which adds cache_control in urlpatterns.

Link issue #949 and PR #1158


{% block table.tbody.row %}
{% cache 3600 submission_table_row row.record.pk row.record.status row.record.last_update %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of this solution?

This will cache each table row that contains a single submission. Need to test to get the correct cache tag but this is a good start I believe.

Would like to use ADV_CACHE_TIMEOUT here instead of hardcoded "3600". Can you help with that? Tried using context but did not get it to work.

@frjo frjo force-pushed the 949/cache-public-pages branch from 94553af to 3df9287 Compare April 16, 2019 14:11
@frjo frjo force-pushed the 949/cache-public-pages branch from 3df9287 to afaa539 Compare April 17, 2019 07:21
@frjo
Copy link
Member

frjo commented Apr 17, 2019

@Parbhat I removed the Advanced cache template tag parts. Should be in another pr and when I started testing the performance impact was small.

@Parbhat
Copy link
Contributor Author

Parbhat commented Apr 17, 2019

@frjo The solution for caching table using cache template tag looks good. There are some UI issues in some pages like dashboard start showing checkboxes at the start of the row. These issues can be fixed. We can also use the normal cache template tag instead of advanced django-adv-cache-tag. While testing noticed switching between Django cache tag and django adv cache tag, we need to clear the cache. Creating a separate PR will be good.

@frjo frjo self-requested a review April 17, 2019 07:42
@frjo frjo added the RTBC label Apr 17, 2019
@frjo frjo merged commit 1d91731 into master Apr 26, 2019
@frjo frjo deleted the 949/cache-public-pages branch July 12, 2019 11:57
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

Successfully merging this pull request may close these issues.

2 participants