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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

lock()<br />

Parameters<br />

• node — the global node to be accessed.<br />

• callback_function — a function of the form function(error, result){} used to return results<br />

asynchronously (see “Synchronous vs. Asynchronous cache.node Methods”).<br />

Example<br />

mydata.kill(<br />

{global: "Customer", subscripts: [1]},<br />

function(error, result) { // callback code }<br />

);<br />

Result:<br />

Operation successful if no error reported.<br />

4.9 lock()<br />

The lock() method locks global nodes for exclusive use by your program. The method can lock either an entire Global (for<br />

example, ^Customer) or sub-sections of a Global (for example, ^Customer(1)).<br />

To prevent deadlock situations, all global nodes that your code has locked should be unlocked before your program terminates<br />

(see unlock()).<br />

Synchronous<br />

Asynchronous<br />

Parameters<br />

var result = mydata.lock(node);<br />

mydata.lock(node, callback_function);<br />

• node — the global node to be accessed.<br />

• callback_function — a function of the form function(error, result){} used to return results<br />

asynchronously (see “Synchronous vs. Asynchronous cache.node Methods”).<br />

Example<br />

mydata.lock(<br />

{global: "Customer", subscripts: [1]},<br />

function(error, result) { // callback code }<br />

);<br />

Result:<br />

Operation successful if no error reported.<br />

4.10 merge()<br />

The merge method copies all or part of a global to another global.<br />

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

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

Saved successfully!

Ooh no, something went wrong!