ZCache ZCacheBean Documentation
For detailed JavaDoc documentation about the APIs in this bean, click
We often refer to ZCacheBean as the ZCacheClient, or just the "client", since ZCacheClient is the
name of the class that must be instantiated in order to make calls to its public methods.
The code snippets included here are by no means definitive, but they will give the developer a good starting
point on how to implement this bean. Obviously, a ZCache server must be running and properly configured in order
for these snippets to work. As with any database program the tables and fields must exist.......
These samples are just a guideline.
In the documentation for the APIs (Methods) you'll see that the data returned is in a String form. This is
the case with all the methods.
If you are NOT using the ZCacheBean.jar, remember that when doing a read operation, the return data will include
a cache object number. There is a significant improvement in read times if you use this object number as a part
of the read. ( i.e. R:433 ) The performance boost comes into play because the same search object can be reused
with significantly less processing than when the object identifier is not included. The ZCacheBean jar uses object
numbers automatically, improving performance and simplifying development.
While it is true that an existing object will be located and used whenever possible, performance is degraded.
Use the object number whenever possible.
Before you can make any of the ZCacheBean.ZCacheClient calls to the methods listed below, you must first initialize
You do so by making the following calls once for each instantiation of the client:
Instantiation of the client:
private ZCacheBean.ZCacheClient zdc = new ZCacheBean.ZCacheClient();
Set the IP address of ZCache in the client. This tells the client where ZCache is running:
Set the port ZCache is listening on in the client. This tells the client which port to use to communicate with
Set the security prefix for ZCache in the client. This tells the client the security prefix to use to communicate
with ZCache. This must match exactly the security prefix found in the configuration of ZCache:
Set the secure mode flag in the client. This must match the secure mode setting found in the configuration of
If you are not using secure mode, set it to false:
There are four steps to configuring SecureMode.
After secure mode has been set up all operations are the same. Performance slows somewhat, due to increased
encryption/decryption processing, but in most cases this is not noticeable and is always a price you have to pay
for secure data transfers.
When compared to other encryption systems SecureMode is very fast. Unlike other systems (i.e. SSL), protocol
negotiations are not needed and the result is much faster response to a query.
String req3 =
result = zdc.putRecord( req3 );
String req2 =
result = zdc.delRecord( req2 );
String req =
result = zdc.putUpdate( req );
Using ZCache is greatly simplified by using the ZCacheBean. The following are two code snippets that illustrate
the simplicity of using ZCache with this bean.
While understanding the low level protocol is an advantage, with this bean access is really simple.
The following gets a file. zds is an instantiated ZCacheBean.ZCacheClient object.
void getFileBtn_ActionPerformed_Interaction1(java.awt.event.ActionEvent event)
void getDataBtn_ActionPerformed_Interaction1(java.awt.event.ActionEvent event)
String saray =
results = zds.getData(saray);
Return Data Structure
The data returned always returns in the form of a String
ZCacheClient returns the text "Inserted OK" in the first element of the returned String array if the
operation was successful. The second element contains the number of the record that was inserted. The application
then knows the record number that was inserted in case it needs to use that record number as an ID in other records
that may be inserted.
ZCacheClient returns the text "Deleted OK" in the first element of the returned String array if the operation
ZCacheClient returns the text "Updated OK" in the first element of the returned String array if the operation
ZCacheClient just returns the information generated by the ZCache request. Each element of the returned String
array represents one record from the database. If no data was found or an error occured, null is returned.
This documentation reflects the latest information available. We intend to expand and improve this document
over time, so you may want to mark this page and return often if you are a developer using ZCache.