Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

VXIcacheInterface Implementation


Detailed Description

SBcache interface, and implementation of VXIcacheInterface which permits writing arbitrary data into the cache with a client supplied key name, then retrieving that data from the cache one or more times by reading against that key name.

Normally the cache implementation can choose to discard the data between the write and the read when necessary (due to running out of cache space, etc.), but it is also possible for clients to lock data in the cache to support built-in grammars and other data that is explicitly provisioned by system administrators and thus must not be removed unless by explicit system administrator command.

See VXIcache.h for additional details.

This implementation currently does NOT factor in CACHE_CREATION_COST when determining how to clean up the cache, and all caching is done on disk resulting in CACHE_FLAG_LOCK_MEMORY being treated as CACHE_FLAG_LOCK. In addition, CACHE_FLAG_NONBLOCKING_IO is ignored, disk I/O is done in a blocking manner (usually undetectable by clients since local disks are used). Long key names are handled using MD5 digests as described as a potential implementation choice in VXIcache.h.

There is one cache interface per thread/line.


Functions

*SBCACHE_API VXIcacheResult SBcacheInit (VXIlogInterface *log, const VXIunsigned diagLogBase, const VXIchar *cacheDir, const int cacheSizeMB, const int entryMaxSizeMB, const int entryExpTimeSec, VXIbool unlockEntries, const int cacheLowWaterMB)
 Global platform initialization of SBcache.
SBCACHE_API VXIcacheResult SBcacheShutDown (VXIlogInterface *log)
 Global platform shutdown of SBcache.
SBCACHE_API VXIcacheResult SBcacheCreateResource (VXIlogInterface *log, VXIcacheInterface **cache)
 Create a new cache service handle.
SBCACHE_API VXIcacheResult SBcacheDestroyResource (VXIcacheInterface **cache)
 Destroy the interface and free internal resources.


Function Documentation

SBCACHE_API VXIcacheResult SBcacheCreateResource VXIlogInterface log,
VXIcacheInterface **  cache
 

Create a new cache service handle.

Parameters:
log [IN] VXI Logging interface used for error/diagnostic logging, must remain a valid pointer throughout the lifetime of the resource (until SBcacheDestroyResource() is called)
cache [IN/OUT] Will hold the created cache resource.
Returns:
VXIcache_RESULT_SUCCESS on success

SBCACHE_API VXIcacheResult SBcacheDestroyResource VXIcacheInterface **  cache  ) 
 

Destroy the interface and free internal resources.

Once this is called, the logging interface passed to SBcacheCreateResource( ) may be released as well.

Parameters:
cache [IN/OUT] The cache resource created by SBcacheCreateResource()
Returns:
VXIcache_RESULT_SUCCESS on success

* SBCACHE_API VXIcacheResult SBcacheInit VXIlogInterface log,
const VXIunsigned  diagLogBase,
const VXIchar cacheDir,
const int  cacheSizeMB,
const int  entryMaxSizeMB,
const int  entryExpTimeSec,
VXIbool  unlockEntries,
const int  cacheLowWaterMB
 

Global platform initialization of SBcache.

Parameters:
log VXI Logging interface used for error/diagnostic logging, only used for the duration of this function call
cacheDir Cache directory name
cacheSizeMB Maximum size of the data in the cache directory, in megabytes
entryMaxSizeMB Maximum size of any individual cache entry, in megabytes
entryExpTimeSec Maximum amount of time any individual cache entry will remain in the cache, in seconds
unlockEntries TRUE to unlock locked entries on startup (from using CACHE_FLAG_LOCK and CACHE_FLAG_LOCK_MEMORY), FALSE to leave them locked. In most cases it is best to pass TRUE with the platform re-adding locked entries at startup in order to avoid having obsolete locked entries fill up the cache. However, for some multi-process oriented integrations it may be necessary to pass FALSE and do this cleanup in some other way.
Returns:
VXIcache_RESULT_SUCCESS on success

SBCACHE_API VXIcacheResult SBcacheShutDown VXIlogInterface log  ) 
 

Global platform shutdown of SBcache.

Parameters:
log VXI Logging interface used for error/diagnostic logging, only used for the duration of this function call
Returns:
VXIcache_RESULT_SUCCESS on success


Generated on Wed Jun 1 12:50:19 2005 for OpenVXI by  doxygen 1.4.2