Class NstFileStorage

Description

This class provides a file based implementation remote storage support for the NstRemoteStorage JavaScript class.

This class provides both load() and store() methods to support the client side NstRemoteStorage JavaScript class. NST WUI based pages don't interact with this object directly. They will typically go through the "php/system/storage.php" page.

It has a process method which can handle a storage request and return an appropriate storage response for the following GET/POST parameters (session defaults to true if omitted):

session=BOOL&op=load&pkg=PKG&key=KEY&val=VALUE Loads VALUE for KEY under PKG and returns a JSON response of: { op: "load", rc: 0, pkg: "PKG", key: "KEY", val: "VALUE" } NOTE: rc will be 0 if successful, and VALUE will be value loaded instead of default value passed. session=BOOL&op=store?pkg=PKG&key=KEY&val=VALUE Stores VALUE for KEY under PKG and returns a JSON response of: { op: "store", rc: 0, pkg: "PKG", key: "KEY", val: "VALUE" } NOTE: rc will be 0 if successful.

Located in /lib/NstFileStorage.php (line 46)

Json
   |
   --NstFileStorage
Method Summary
void load ( $pkg,  $key,  $defaultValue)
void process ()
void remove ( $pkg,  $key)
void store ( $pkg,  $key,  $value)
Methods
load (line 123)

Load a value of a object associated with a key under a specific package.

$pkg - The package identifier (like: 'nstwui.test'). $key - The key within the package (like: 'host'). $defaultValue - The default value to return if not found.

  • access: public
void load ( $pkg,  $key,  $defaultValue)
  • $pkg
  • $key
  • $defaultValue
process (line 56)

Method which can be invoked to process a GET/POST request to load/store values at the server.

  • access: public
void process ()
remove (line 158)

Remove a value (file) associated with a key under a specific package.

$pkg - The package identifier (like: 'nstwui.test'). $key - The key within the package (like: 'host').

Returns true if removed (or not present), FALSE on failure.

  • access: public
void remove ( $pkg,  $key)
  • $pkg
  • $key
store (line 144)

Store a value of a object associated with a key under a specific package.

$pkg - The package identifier (like: 'nstwui.test'). $key - The key within the package (like: 'host'). $value - The string value to store (like: '10.8.68.2').

Returns the number of bytes written or FALSE on failure.

  • access: public
void store ( $pkg,  $key,  $value)
  • $pkg
  • $key
  • $value

Inherited Methods

Inherited From Json

Json::exec()
Json::execResults()
Json::getCommand()
Json::getCommandLine()
Json::getValue()
Json::postResults()
Json::setHeader()

Documentation generated on Sun, 11 Feb 2018 07:41:02 -0500 by phpDocumentor 1.4.4