Plugins:ApplicationStorage

<< Back to Dashboard

Contents

Exploring the ApplicationStorage Plugin

Overview

Application Storage plugin. It provides the user with a mechanism for permanent data storage using the application scope.

setVar

Set a new permanent variable.

Returns

  • This function returns void

Arguments

Key Type Required Default Description
name string Yes --- The name of the variable.
value any Yes --- The value to set in the variable.

Examples

getPlugin("ApplicationStorage").setVar("service", myService);

getVar

Get a new permanent variable. If the variable does not exist. The method returns blank unless using the default return argument.

Returns

  • This function returns any

Arguments

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.

Examples

// No default
var service = getPlugin("ApplicationStorage").getVar("service");

// With Default
var onlineBit = getPlugin("ApplicationStorage").getVar("onlineBit", false);

removeStorage

remove the entire storage from scope

Returns

  • This function returns void

Examples

getPlugin("ApplicationStorage").removeStorage();

exists

Checks wether the permanent variable exists.

Returns

  • This function returns boolean

Arguments

Key Type Required Default Description
name string Yes --- The variable name to retrieve.

Examples

if ( getPlugin("ApplicationStorage").exists("onlineBit") ){

}

clearAll

Clear the entire coldbox application storage

Returns

  • This function returns void

Examples

getPlugin("ApplicationStorage").clearAll();

deleteVar

Tries to delete a permanent application variable. Returns True if deleted.

Returns

  • This function returns boolean

Arguments

Key Type Required Default Description
name string Yes --- The variable name to retrieve.

Examples

getPlugin("ApplicationStorage").deleteVar("onlineBit");

getStorage

Get the entire storage scope structure

Returns

  • This function returns struct

Examples

var appStorage = getPlugin("ApplicationStorage").getStorage();

 
Download in other Formats:
markup Markup | pdf PDF | html HTML | word Word

comments Comments (0)


ColdBox Book

book