[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 2


FrcaCacheLoadFile Subroutine

Purpose

Loads a file into a cache associated with a Fast Response Cache Accelerator (FRCA) instance.

Library

FRCA Library (libfrca.a)

Syntax


#include <frca.h>
int32_t FrcaCacheLoadFile ( CacheHandle, FrcaHandle, FileSpec, AssocData);
int32_t CacheHandle;
int32_t FrcaHandle;
frca_filespec_t * FileSpec;
frca_assocdata_t * AssocData;

Description

The FrcaCacheLoadFile subroutine loads a file into an existing cache instance for an previously configured FRCA instance.

Parameters


CacheHandle Identifies the cache instance to which the new entry should be added.
FrcaHandle Identifies the FRCA instance to which the cache instance belongs.
FileSpec Points to a frca_loadfile_t structure, which specifies characteristics used to identify the cache entry that is to be loaded into the given cache. The structure contains the following members:
uint32_t cacheEntryType;
char * fileName;
char * virtualHost;
char * searchKey;

Note: Structure members do not necessarily appear in this order.

cacheEntryType
Specifies the type of the cache entry. This field must be set to FCTRL_CET_HTTPFILE.

fileName
Specifies the absolute path to the file that is providing the contents for the new cache entry.

virtualHost
Specifies a virtual host name that is being served by the FRCA instance.

searchKey
Specifies the key that the cache entry can be found under by the FRCA instance when it processes an intercepted request. For the HTTP GET engine, the search key is identical to the abs_path part of the HTTP URL according to section 3.2.2 of RFC 2616. For example, the search key corresponding to the URL http://www.mydomain/welcome.html is /welcome.html.

Note: If a cache entry with the same type, file name, virtual host, and search key already exists and the file has not been modified since the existing entry was created, the load request succeeds without any effect. If the entry exists and the file's contents have been modified since being loaded into the cache, the cache entry is updated. If the entry exists and the file's contents have not changed, but any of the settings of the HTTP header fields change, the existing entry must be unloaded first.

AssocData Points to a frca_assocdata_t structure, which specifies additional information to be associated with the contents of the given cache entry. The structure contains the following members:
uint32_t assocDataType;
char * cacheControl;
char * contentType;
char * contentEncoding;
char * contentLanguage;
char * contentCharset;

Note: Structure members do not necessarily appear in this order.

assocDataType
Specifies the type of data that is associated with the given cache entry.

cacheControl
Specifies the settings of the corresponding HTTP header field according to RFC 2616.

contentType
Specifies the settings of the corresponding HTTP header field according to RFC 2616.

contentEncoding
Specifies the settings of the corresponding HTTP header field according to RFC 2616.

contentLanguage
Specifies the settings of the corresponding HTTP header field according to RFC 2616.

contentCharset
Specifies the settings of the corresponding HTTP header field according to RFC 2616.

Return Values


0 The subroutine completed successfully.
-1 The subroutine failed. The global variable errno is set to indicate the specific type of error.

Error Codes


EINVAL The FileSpec or the AssocData parameter is zero or are not of the correct type or any of the fileName or the searchKey components are zero or the size of the file is zero.
EFAULT The FileSpec or the AssocData parameter or one of their components points to an invalid address.
ENOMEM The FRCA or NBC subsystem is out of memory.
EFBIG The content of the cache entry failed to load into the NBC. Check network options nbc_limit, nbc_min_cache, and nbc_max_cache.
ENOTREADY The kernel extension is currently being loaded or unloaded.
ENOENT The CacheHandle or the FrcaHandle parameter is invalid.

Related Information

The FrcaCacheCreate subroutine, FrcaCacheDelete subroutine, FrcaCacheUnloadFile subroutine, FrcaCtrlCreate subroutine, FrcaCtrlDelete subroutine, FrcaCtrlLog subroutine, FrcaCtrlStart subroutine, FrcaCtrlStop subroutine.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]