CacheRecord

The CacheRecord method attempts to add the specified record to the specified cache.

Method Synopsis

CacheRecord($record)

Parameters

$record
Specifies the record that is to be added to the cache. This record is expressed as a hash.

Description

The CacheRecord method adds the record specified in the $record parameter to the specified cache. You specified the name of the cache in a previous call to the RIV::RecordCache constructor.

Example Usage

The following example illustrates a typical call to the CacheRecord method, where the method caches the record (hash) called $myRec:

$cache->CacheRecord($myRec);

Returns

Upon completion, the CacheRecord method returns:

  • The value -1 to indicate that the attempt to add the record to the cache was unsuccessful. The method displays an appropriate error message requesting that you check to ensure that the cache is valid.
  • The key that the record was added under if the attempt to add the record to the cache was successful.

See Also