|
Application Storage plugin. It provides the user with a mechanism for permanent data storage using the application scope.
Set a new permanent variable.
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | Yes | --- | The name of the variable. |
| value | any | Yes | --- | The value to set in the variable. |
getPlugin("ApplicationStorage").setVar("service", myService);
Get a new permanent variable. If the variable does not exist. The method returns blank unless using the default return argument.
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | Yes | --- | The variable name to retrieve. |
| default | any | No | The default value to set. If not used, a blank is returned. |
// No default var service = getPlugin("ApplicationStorage").getVar("service"); // With Default var onlineBit = getPlugin("ApplicationStorage").getVar("onlineBit", false);
remove the entire storage from scope
getPlugin("ApplicationStorage").removeStorage();
Checks wether the permanent variable exists.
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | Yes | --- | The variable name to retrieve. |
if ( getPlugin("ApplicationStorage").exists("onlineBit") ){ }
Clear the entire coldbox application storage
getPlugin("ApplicationStorage").clearAll();
Tries to delete a permanent application variable. Returns True if deleted.
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | Yes | --- | The variable name to retrieve. |
getPlugin("ApplicationStorage").deleteVar("onlineBit");
Get the entire storage scope structure
var appStorage = getPlugin("ApplicationStorage").getStorage();