Allow running Application.cfc only once

Description

The idea is to allow an application.cfc to be run once and not for every request

"this.singelton=true"

Naming is a placeholder for now

Background: currently the application.cfc is executed for every request, which adds over head

Things to be considered, currently each request has it's own individual settings and a shared application scope, i.e application action=”update” can change the settings for just the current request

Activity

Show:

Pothys - MitrahSoft 12 February 2025 at 09:39

, I tested this ticket with Lucee version 7.0.0.103-SNAPSHOT. After setting the environment variables LUCEE_LISTENER_SINGELTON=true and using setenv.bat -Dlucee.listener.singelton=true, now the Application.cfc was loaded only once and it worked as expected.

Ben Nadel 10 February 2025 at 16:15

very cool! This will make loading and caching configurations much easier 🙂

Michael Offner 7 February 2025 at 18:38

Michael Offner 7 February 2025 at 18:34

Added Application.cfc Singleton Support (optional feature)

This enhancement introduces a new optional feature to optimize Application.cfc handling. The default behavior remains unchanged to maintain backwards compatibility, as many applications have initialization logic in their component body constructors.

When enabled, Application.cfc is loaded once and cached, reducing overhead for applications that follow best practices of containing logic within lifecycle methods (onApplicationStart, onRequestStart, etc).

To enable singleton mode:

  • Environment Variable: LUCEE_LISTENER_SINGELTON=true

  • System Property: -Dlucee.listener.singelton=true

  • CFConfig: listenerSingelton=true

Implementation: https://github.com/lucee/Lucee/commit/ec8c5a76c6a96ebdad6a32ceafc2f3d229f948d2 Documentation: https://github.com/lucee/lucee-docs/commit/ded5bf7e0f7d7888fe52e482be78b6527971b72e

 

Zac Spitzer 3 July 2024 at 10:15

you can use {env.SENTRY_DSN} in config files https://github.com/lucee/lucee-data-provider/blob/main/devops/.CFconfig-update.json5#L135 but there are problems https://luceeserver.atlassian.net/browse/LDEV-4955 too, swings and roundabouts

Fixed

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Fix versions

Priority

Created 2 July 2024 at 08:59
Updated 12 February 2025 at 14:15
Resolved 12 February 2025 at 14:15

Flag notifications