gtpc2m1gC/C++ Language Support User's Guide

deleteCacheEntry-Delete a Cache Entry

This function deletes a cache entry.

Format

#include  <c$cach.h>
long       deleteCacheEntry(const cacheToken *cache_to_delete,
                            const void *primary_key,
                            const long *primary_key_length,
                            const void *secondary_key,
                            const long *secondary_key_length);   

cache_to_delete
The returned cache_token from the newCache function that created the logical record cache.

primary_key
A pointer to a field that contains the value of the primary key.

primary_key_length
The length of the primary key for a cache entry. The length specified must be equal to or less than the maximum value specified for the newCache function.

secondary_key
A pointer to a field that contains the value of the secondary key. If a secondary key was not specified for the newCache function, this field is ignored and will contain a NULL pointer.

secondary_key_length
The length of the specified secondary key. The length specified must be equal to or less than the maximum value specified for the newCache function.

Normal Return

CACHE_SUCCESS
The function is completed successfully.

Error Return

One of the following:

CACHE_ERROR_HANDLE
The cache_token provided for the cache_to_delete parameter is not valid.

CACHE_ERROR_PARAM
The value passed for one of the parameters is not valid.

Programming Considerations

Examples

The following example deletes a cache entry from the file system INODE cache if it exists.

#include <c$cach.h>
#include <i$glue.h
 
    struct icontrol * contrl_ptr;    /* pointer file system control area */
    const long  primaryKeyLgh = sizeof(ino_t);   /* INODE number is key */
    long nodeord;                                /* INODE number       */
 
/*  get pointer to file system control area                           */
 
    contrl_ptr = cinfc_fast_ss(CINFC_CMMZERO,
                  ecbptr()->ce1dbi );
 
/*  if using INODE cache, call to delete possible old entry for this INODE */
 
    if (contrl_ptr->icontrol_icacheToken.token1 != 0)
         deleteCacheEntry(&contrl_ptr-;>icontrol_icacheToken,
                          &nodeord,
                          &primaryKeyLgh,
                           NULL,
                           NULL);
 

Related Information