flashscope object (Best Practice)
persistVariables()method from the super type and ColdBox Controller
persistencearguments in the
relocate()method from the super type and ColdBox Controller.
flashscope object is our best practice approach as it clearly demarcates the code that the developer is using the flash scope for persistence. Any flash scope must inherit from our
AbstractFlashScopeand has access to several key methods that we will cover in this section. However, let's start with how the flash scope stores data:
saveFlash()method is called then the data is immediately serialized and stored in the implementation's persistent storage.
Caution By default the Flash RAM queues up serializations for better performance, but you can alter the behavior programmatically or via the configuration file.Info If you use the
persistVariables()method or any of the persistence arguments on the
relocate()method, those variables will be saved and persisted immediately.
Info Please note that the majority of a Flash scope methods return itself so you can concatenate method calls. Below are the main methods that you can use to interact with the Flash RAM object:
Info We would advice to not overuse this method as some storage scopes might have delays and serializations