gtpc2m5n | C/C++ Language Support User's Guide |
This function reads a cache entry.
Format
#include <c$cach.h> long readCacheEntry( const cacheToken * cache_to_read), const void *primary_key, const long *primary_key_length, const void *secondary_key, const long *secondary_key_length, long *size_of_buffer, void *buffer);
Normal Return
Error Return
One of the following:
Programming Considerations
The primary and secondary keys must exactly match the primary and secondary keys used to add an entry to the cache. The entry control block (ECB) must have the same database ID (DBI) as the ECB used to create the entry.
Examples
The following example reads a cache entry from the file system directory cache.
#include <c$cach.h> #include <i$glue.h> struct itran *tran; long primaryKeyLgh = strlen( tran->itran_response.itres_name ); long secondaryKeyLgh = sizeof(ino_t); struct TPF_directory_entry tde; long bufferSize= sizeof(struct TPF_directory_entry); struct icontrol * contrl_ptr; /* pointer file system control area */ contrl_ptr = cinfc_fast_ss(CINFC_CMMZERO, ecbptr()->ce1dbi); if ((contrl_ptr->icontrol_dcacheToken.token1 == 0) || (readCacheEntry(&contrl_ptr->icontrol_dcacheToken, &tran->itran_response.itres_name, &primaryKeyLgh, &tran->itran_response. itres_parent_inode.inode_ino, &secondaryKeyLgh, &bufferSize, &tde) != CACHE_SUCCESS)) [ /* read directory entry from file */ ]
Related Information