This function relies on checking the disable_action_cache static variable before accessing the layer cache.