Elevate Web Cache Model
Description
Elevate Web includes/has plans to integrate several cache layers:
- Route cache: Elevate Web should (not yet implemented) a per route (instance) cache to ensure that a user will get a fast route response whenever possible
- Service/Provider cache: Elevate Web should (not yet implemented) a per Service/Provider method response cache (after parsing).
- Fetch/Request cache: Elevate Web implements a per http/request cache
Route cache Details
To Be defined.
We need to investigate how to use Next.js capabilities to optimize how routes are cached
Service/Provider cache Details
The initial Service/Provider cache configuration model was defined to be mixed within the Fetch/Request cache
but we finally remove it from the Fetch cache opting for a more simplistic implementation, but the initial setup/config process is done in:
src/services/config.ts
src/services/manager.ts
src/services/cache.ts
and the initial config usage and extra service fetcher utility was created in:
src/utils/fetcher.ts
The implementation on the Providers is planned to be done using Typescript Decorator as done in E&L PS Global Middleware and a cache system with serviceName-methodName
key model but it's not implemented.
Fetch/Request cache
Using the Next.js request cache and a default ENV VAR configurable CACHE_REVALIDATION
+ default DEFAULT_CACHE_REVALIDATION
constant Elevate Web cache all the HTTP fetch request (Accedo Control, OVP, ...).
Next.js doesn't allow to define the revalidate value on config and the appInitialization is done before routes/layout are handled from Next.js