- caches the rendering of slot components passed to it
usage is as simple as this
<Cache>
<Menu />
</Cache>
can also have different names that act as store keys
<Cache name="section1">
<Menu section="section1"/>
</Cache>
Note1 : This will cache all calls from all isntances, if the intended usage is a different cache set for every astro component file, then it is still required that the user gives a different name
for every instance, e.g. prefix component path (with e.g. a vite __filedir plugin )
Note2: This is caching production only for convenience during development, if caching is also intended during development (not recommended) then this line in Cache.astro
can be changed to remove the PROD condition
if(cache_has(name) && import.meta.env.PROD){
Test, see build log, both pages build are logged while the rendering of the cached component is logged only once
index> rendering index page
** rendering ** 'default' => cache_set()
page2> rendering page2
References