25.01.2015 Views

Using Node.js with Caché - InterSystems Documentation

Using Node.js with Caché - InterSystems Documentation

Using Node.js with Caché - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Overview of cache.node Methods<br />

{<br />

}<br />

"ErrorMessage": [error message text],<br />

"ErrorCode": [error code],<br />

"ok": [true|false]<br />

For synchronous operation, you should check for the existence of these properties in the result object to determine whether<br />

or not an error has occurred.<br />

3.3 Overview of cache.node Methods<br />

The individual cache.node methods are described in detail in the reference section. Here is a brief summary of the available<br />

methods and their uses, <strong>with</strong> links to the reference section entries:<br />

Opening and closing the database<br />

See “Opening and Closing the <strong>Caché</strong> Database” for basic information on using these methods:<br />

• open() — opens the specified <strong>Caché</strong> database.<br />

• close() — closes a previously opened database.<br />

Operations on individual nodes<br />

• set() — sets the value of a global node.<br />

• get() — retrieves a global node.<br />

• kill() — deletes a global node.<br />

• increment() — adds 1 to the value of an integer in a global node.<br />

• merge() — copies all or part of a global to another global.<br />

Iteration over global nodes<br />

• data() — tests for the existence of a global node.<br />

• next() and previous() — gets the next or previous global node subscript on the current level.<br />

• next_node() and previous_node() — gets the next or previous global node in collation order regardless of<br />

level.<br />

• lock() and unlock() — locks global nodes for exclusive use, and unlocks nodes previously locked by your<br />

program.<br />

Advanced data access<br />

These methods perform batch read and write operations that are frequently more efficient than access <strong>with</strong> the<br />

basic NoSQL-style methods:<br />

• retrieve() — recursively retrieves all global nodes defined beneath a specified level and returns them as a<br />

single JSON object.<br />

• update() — uses information in a JSON object to write a set of globals to the database.<br />

See “Advanced Data Access <strong>with</strong> retrieve() and update()” for a detailed discussion of usage.<br />

<strong>Using</strong> <strong>Node</strong>.<strong>js</strong> <strong>with</strong> <strong>Caché</strong> 9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!