Previous Topic

Next Topic

ctFILELIST

Manage file-specific cache features.

Short Name

ctFILELIST()

Type

Utility Function

Declaration

NINT ctFILELIST(pTEXT filnam, pLONG pvalue, pLONG pmember,
                NINT state, NINT action)

Description

ctFILELIST() manages the advanced file-specific cache capabilities for standalone and bound server applications. ctFILELIST() must be called prior to the creation or opening of filnam for the cache capabilities to take effect. If multi-byte file names are supported (e.g., Unicode), the configuration information (or direct call to ctFILELIST()) must have the file names in UTF8 form (i.e., a NULL terminated string).

The state parameter determines which cache capability is invoked, with pvalue and pmember providing supplemental information, as shown in the table below (which assumes the action ctADDfilelist):

state

Description

ctSPLCACHElist

Assign pvalue bytes of dedicated cache to filnam.

ctPRICACHElist

Loads pvalue bytes from the beginning filnam into cache.

ctNO_CACHElist

Prevents filnam from using cache.

ctPRIINDEXlist

Loads pvalue bytes from the beginning of index member pmember in index file filnam into cache. A negative value for pmember indicates the entire index.

ctNO_FLUSHlist

Sets filnam to not flush cache at file close.

The action parameter can be used to add a file to a list, check or change the values associated with a file on a list, or to remove a file from a list. Changes made to an open file have no effect until the next time the file is opened.

state

Description

ctADDfilelist

Add a file to the list.

ctSRCfilelist

Return current values for file.

ctCHGfilelist

Change values for listed file.

ctREMfilelist

Remove file from list.

Return

Value

Symbolic Constant

Explanation

0

NO_ERROR

Successful function.

101

INOT_ERR

filnam is not a member of the state list.

See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.

Example

TEXT      filnam = “custmast.dat”;
LONG      bytes = 4000000;
NINT      rcN = 0;
COUNT     rc2 = 0;

/* Set the file to use 4000000 bytes dedicated cache. */
if (rcN = ctFILELIST(&filnam, &bytes, NULL, ctSPLCACHElist,
                     ctADDfilelist))
    errorReturn(rcN, “Error on SPLCACHE assignment”);

/* Set the file to load 4000000 bytes to cache at open. */
if (rcN = ctFILELIST(filnam, &bytes, NULL, ctPRICACHElist,
                     ctADDfilelist))
    errorReturn(rcN, “Error on SPLCACHE assignment”));

/* Open the file and load 4000000 bytes to dedicated cache */
if (rc2 = OpenFileWithResource(-1, &filnam, ctSHARED))
    errorReturn(rc2, “Error opening file.”);

Limitations

The ctFILELIST() processing, used to store and retrieve cache parameters, ignores the mirrored portion of a file name. Only the primary file is cached.

See also

“c-tree Server Cache Sub-System