gtpc2m9b | C/C++ Language Support User's Guide |
This function adds a new cache entry or updates an existing cache entry.
Format
#include <c$cach.h> long updateCacheEntry(const cacheToken *cache_to_update, const void *primary_key, const long *primary_key_length, const void *secondary_key, const long *secondary_key_length, const long *size_of_entry, const void *entry_data, const long *timeout, const char *invalidateOthers);
If the pointer to a char is set to Cache_Invalidate, logical record cache support tries to invalidate any other processor's cache entry for the specified entry.
Normal Return
Error Return
One of the following:
Programming Considerations
To ensure data integrity, the caller must ensure that a locking mechanism is used when using the updateCacheEntry function.
Examples
The following example adds a cache entry to the file system directory cache.
#include <c$cach.h> #include <i$glue.h> struct ilink * link; struct TPF_directory_entry new_tde = { TPF_FS_DIRECTORY_CURRENT_VERSION }; const long dataLength = sizeof(new_tde); /* size of directory entry */ const long primaryKeyLgh = strlen( link->ilink_file_name ); const long secondaryKeyLgh = sizeof(ino_t); /* INODE number */ struct icontrol * contrl_ptr; /* pointer file system control area */ /* setup file system directory entry with values from the input */ new_tde.TPF_directory_entry_ino = link->ilink_file_inode_ordinal; new_tde.TPF_directory_entry_igen = link->ilink_file_inode->inode_igen; /* get pointer to file system directory cache token if one */ contrl_ptr = cinfc_fast_ss(CINFC_CMMZERO, ecbptr()->ce1dbi ); if (contrl_ptr->icontrol_dcacheToken.token1 != 0) /* have a directory cache, update it with directory entry */ updateCacheEntry(&contrl_ptr->icontrol_dcacheToken, link->ilink_file_name, &primaryKeyLgh, &link->ilink_parent_inode->inode_ino, &secondaryKeyLgh, &dataLength, &new_tde, NULL, NULL );
.
Related Information