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

Page pre-cache proposal #179

Open
mingard opened this issue May 31, 2017 · 0 comments
Open

Page pre-cache proposal #179

mingard opened this issue May 31, 2017 · 0 comments

Comments

@mingard
Copy link
Contributor

mingard commented May 31, 2017

Overview

To increase page load, and to reduce load-spikes on web and api during peak period, the previously discussed pre-caching pages concept could be achieved by the following method.

Reduce page parameters

For each page, evaluate the page routes and reduce to a list of parameters

{
 "path": "/news/:category/:title?"
}

Results:

[{
  "key": "category",
  "optional": false
},
{
  "key": "title",
  "optional": true
}]

Evaluate datasource requestParams

"requestParams": [
  {
    "param": "category",
    "field": "categoryHandle"
  },
  {
    "param": "title",
    "field": "handle"
  }
]

Fetch datasource results

Fetch only updatedAt, and filterable field from all datasources attached to all pages. In the example given, this would be categoryHandle, title and of course, updatedAt.

Filter results based on requestParams and routes

Taking all possible combinations of required parameters, e.g. category (categoryHandle) to create a list of page queries, noting that some documents can appear under multiple queries. In this example, the article Article about sport exists under sports and all.

/news/sports/article-about-sport
/news/all/article-about-sport

Pre-cache updated pages

For those page queries that have one or more documents with a updatedAt later than the last time the page was cached, re-cache the page

Refresh cache on non-updated pages

For those page queries that have no documents with an updatedAt later than the last time the page was cached, extend the cache

I may have missed something here, feedback appreciated.

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

No branches or pull requests

2 participants