Mobile Menu API - docroot/profiles/custom/cgov_site/modules/custom/cgov_site_section/src/Controller/CgovMegaMenuController.php
Nav APIs - docroot/profiles/custom/cgov_site/modules/custom/cgov_site_section/src/Controller/CgovNavTreeController.php
Both APIs are using the default $config['system.performance']['cache']['page']['max_age'] settings for the maximum age to cache. (16588800)
THIS IS CORRECT FOR ANYTHING FRONTED BY Akamai. -- it tells Akamai to cache the JSON response until the cache tag for the contents are cleared.
For anything not fronted by Akamai it is a pain, as that will tell the web browser to keep it for a very long time. This results in a lot of "why does X not work? Did you clear your browser cache?" back and forths that slow things down.
It should be noted that an alternative that we are skipping over would be to add cache-busting query params to the API fetches. This could work for the Mega Menu as Drupal adds attributes to the menu items for what to fetch. For the Nav API we would have to do a lot of refitting to make it work. (Drupal would need to add a revision or something to each nav in the tree. Adding the cache-busting query param would ensure that changes appear immediately.
Tasks
[ ] Add a config for the cgov_site_section module with a api_cache_max_age setting. The default should be 16588800
NOTE: There will need to be a new schema for the config.
[ ] Update the controllers to use that new setting.
[ ] Update our BLT settings file for cacheing to set the value to be 5 for any non-acsf dev environments.
5 seconds is small enough to not annoy people, or for them to even notice, but something that an automated testing script can see that the cache header is correctly being set.
The file location is docroot/sites/settings/cgov_caching.settings.php
The envs should be dev, int, test, ode
IDK what local is, but it should be included as well.
[ ] Update Akamai rules to set downstream cache headers to only cache for 5-15min.
This will tell user's web browsers to only keep it for a short period.
The X-cms properties should never cache anyway. This will need to make sure that is the case so CMS editors are able to see their changes on x-cms while they are editing. (They will still have to wait 5-15min to see them on the front-end.)
This issue affects the following APIs:
Mobile Menu API -
docroot/profiles/custom/cgov_site/modules/custom/cgov_site_section/src/Controller/CgovMegaMenuController.php
Nav APIs -
docroot/profiles/custom/cgov_site/modules/custom/cgov_site_section/src/Controller/CgovNavTreeController.php
Both APIs are using the default
$config['system.performance']['cache']['page']['max_age']
settings for the maximum age to cache. (16588800)It should be noted that an alternative that we are skipping over would be to add cache-busting query params to the API fetches. This could work for the Mega Menu as Drupal adds attributes to the menu items for what to fetch. For the Nav API we would have to do a lot of refitting to make it work. (Drupal would need to add a revision or something to each nav in the tree. Adding the cache-busting query param would ensure that changes appear immediately.
Tasks
api_cache_max_age
setting. The default should be16588800
5
for any non-acsf dev environments.docroot/sites/settings/cgov_caching.settings.php
dev
,int
,test
,ode