Table of Contents Previous Next PDF


Oracle Tuxedo Distributed Caching (TDC) Programming

Oracle Tuxedo Distributed Caching (TDC) Programming
This topic contains the following sections:
Use Oracle Tuxedo Distributed Caching (TDC) Related ATMI APIs
 
For more information about the above APIs, see Section 3c - C Functions.
Put An Oracle Tuxedo Buffer to Cache
TDC APIs tpgetcache and tpcacheput can be used in an Oracle Tuxedo client or server to put an Oracle Tuxedo buffer associated with a key into an Oracle Tuxedo cache.
For more information about tpgetcache and tpcacheput, see Use Oracle Tuxedo Distributed Caching (TDC) Related ATMI APIs.
Listing 3‑1 Put An Oracle Tuxedo Buffer Associated with A Key into An Oracle Tuxedo Cache
...
TCACHE* mycache = NULL;
char mykey[128];
char* databuf = NULL;
 
tpinit(NULL);
databuf = tpalloc("STRING", NULL, 256);
 
mycache = tpgetcache("tc");
strcpy(mykey, "myname");
strcpy(databuf, "scott");
tpcacheput(mycache, mykey, databuf, 0, 0L);
 
tpfree(databuf);
...
 
Get An Oracle Tuxedo Buffer from Cache
TDC APIs tpgetcache and tpcacheget can be used in an Oracle Tuxedo client or server to get an Oracle Tuxedo typed buffer from an Oracle Tuxedo cache according to a key.
For more information about tpgetcache and tpcacheget, see Use Oracle Tuxedo Distributed Caching (TDC) Related ATMI APIs.
Listing 3‑2 Get An Oracle Tuxedo Buffer from an Oracle Tuxedo Cache According to the Key
...
TCACHE* mycache = NULL;
char mykey[128];
char* databuf = NULL;
 
tpinit(NULL);
databuf = tpalloc("STRING", NULL, 256);
 
mycache = tpgetcache("tc");
strcpy(mykey, "myname");
tpcacheget(mycache, mykey, &databuf, NULL, 0L);
tpfree(databuf);
...
 
Remove Oracle Tuxedo Buffer(s) from Cache
TDC APIs tpgetcache and tpcacheremove can be used in an Oracle Tuxedo client or server to remove an Oracle Tuxedo buffer associated with a key from an Oracle Tuxedo cache. See Listing 3‑3 for an example.
Also, you can use TDC API tpcachemremove to remove several Oracle Tuxedo buffers at one time, or use TDC API tpcacheremoveall to remove all the Oracle Tuxedo buffers from an Oracle Tuxedo cache. For more information about these TDC APIs, see Use Oracle Tuxedo Distributed Caching (TDC) Related ATMI APIs.
Listing 3‑3 Remove An Oracle Tuxedo Buffer Associated with A Key from An Oracle Tuxedo Cache
...
TCACHE* mycache = NULL; char mykey[128];
char* databuf = NULL;
 
tpinit(NULL);
databuf = tpalloc("STRING", NULL, 256);
 
mycache = tpgetcache("tc"); strcpy(mykey, "myname");
tpcacheremove(mycache, mykey,0L);
 
tpfree(databuf);
...
 

Copyright © 1994, 2017, Oracle and/or its affiliates. All rights reserved.