You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhancement
At the moment Build Time Render has the concept of a page cache, and appropriate cli options to manage it. This is non programmatic for the end user and is a literal cache of the output of a specific page.
It would be nice if users could programmatically attach resources that are scoped to a page, for example network requests. We could then offer the user to be able to evict those as part of evicting a page from the cache (or not). This would be extremely useful on request heavy pages where the data from the request doesn't often change, these requests are normally quite expensive in terms of rendering for Build Time Render.
To do this, we would have to introduce some kind of Build Time Render api set that can be used in blocks, this has been mused before for different scenarios (dojo/webpack-contrib#134).
For example usage something like this in a block:
import{cache}from'@dojo/framework/core/build'constmyBlock=async(url: string)=>{// where 'current-page' is the scope, might be other options later like 'global'// where 'network-request' is a user defined keyconstmyRequest=cache.get('current-page','network-request',url);if(myRequest){returnmyRequest;}constresponse=awaitfetch(url);constjson=awaitresponse.json();cache.set('current-page','network-request',url,{ json });returnjson;}exportdefaultmyBlock;
We can also potentially build higher level utilities on top of this in @dojo/framework, ie a fetchWithCache etc.
We would then want to supplement the existing page cache command options to be able to evict resources under a page, and list resources under a page too.
The text was updated successfully, but these errors were encountered:
Enhancement
At the moment Build Time Render has the concept of a page cache, and appropriate cli options to manage it. This is non programmatic for the end user and is a literal cache of the output of a specific page.
It would be nice if users could programmatically attach resources that are scoped to a page, for example network requests. We could then offer the user to be able to evict those as part of evicting a page from the cache (or not). This would be extremely useful on request heavy pages where the data from the request doesn't often change, these requests are normally quite expensive in terms of rendering for Build Time Render.
To do this, we would have to introduce some kind of Build Time Render api set that can be used in blocks, this has been mused before for different scenarios (dojo/webpack-contrib#134).
For example usage something like this in a block:
We can also potentially build higher level utilities on top of this in
@dojo/framework
, ie afetchWithCache
etc.We would then want to supplement the existing page cache command options to be able to evict resources under a page, and list resources under a page too.
The text was updated successfully, but these errors were encountered: