CkCache Java Programming
Reference Documentation

CkCache

Properties

// str is a CkString object (output)
LastErrorHtml( str )

Error information in HTML format for the last method called.

// str is a CkString object (output)
LastErrorText( str )

Error information in plain-text format for the last method called.

// str is a CkString object (output)
LastErrorXml( str )

Error information in XML format for the last method called.

// str is a CkString object (output)
get_LastEtagFetched( str )

The ETag of the last item fetched from cache.

// sysTime is a SYSTEMTIME object (output)
get_LastExpirationFetched( sysTime )

Expiration date/time of the last item fetched from cache.

// Returns a boolean value
get_LastHitExpired( )

true if the LastExpirationFetched is before the current date/time. Otherwise false.

// str is a CkString object (output)
get_LastKeyFetched( str )

The key of the last item fetched from cache. (For web pages, the key is typically the canonicalized URL. Otherwise, the key is a unique identifer used to access the cached item.)

// Returns an integer value
get_Level( )

// newVal is an integer (input)
put_Level( newVal )

The number of directory levels in the cache. Possible values are:

0: All cache files are in a single directory (the cache root).

1: Cache files are located in 256 sub-directories numbered 0 .. 255 directly under the cache root.

2: There are two levels of sub-directories under the cache root. The 1st level has 256 sub-directories numbered 0 .. 255 directly under the cache root. The 2nd level allows for up to 256 sub-directories (0..255) under each level-1 directory. Cache files are stored in the leaf directories.

// Returns an integer value
get_NumRoots( )

The number of root directories composing the cache. A typical multi-root cache would place each root on a separate hard drive.

Methods

// path is a string (input)
AddRoot( path )

Must be called once for each cache root. For example, if the cache is spread across D:\cacheRoot, E:\cacheRoot, and F:\cacheRoot, an application would setup the cache object by calling AddRoot three times -- once with "D:\cacheRoot", once with "E:\cacheRoot", and once with "F:\cacheRoot".

// Returns an integer value
DeleteAll( )

Deletes all items in the cache. This method completely clears the cache. All files in the cache are deleted. (If the cache is multi-level, existing sub-directories are not deleted.)

Returns the number of items (i.e. cache files) deleted.

// Returns an integer value
DeleteAllExpired( )

Deletes all expired items from the cache.

Returns the number of items (i.e. cache files) deleted.

// key is a string (input)
// Returns a boolean value
DeleteFromCache( key )

Deletes a single item from the disk cache. Returns false if the item exists in cache but could not be deleted. Otherwise returns true.

// dt is a SYSTEMTIME object (output)
// Returns an integer value
DeleteOlder( dt )

Deletes all items older than a specified date/time.

Returns the number of items (i.e. cache files) deleted.

// key is a string (input)
// outBytes is a CkByteData object (output)
// Returns a boolean value
FetchFromCache( key, outBytes )

Fetches an item from cache.

// key is a string (input)
// outStr is a CkString object (output)
// Returns a boolean value
GetEtag( key, outStr )

Returns the eTag for an item in the cache.

Returns true for success, false for failure.

// key is a string (input)
// sysTime is a SYSTEMTIME object (output)
// Returns a boolean value
GetExpiration( key, sysTime )

Returns the expire date/time for an item in the cache.

// key is a string (input)
// outStr is a CkString object (output)
// Returns a boolean value
GetFilename( key, outStr )

To be documented soon.

Returns true for success, false for failure.

// index is an integer (input)
// outStr is a CkString object (output)
// Returns a boolean value
GetRoot( index, outStr )

Returns the directory path of the Nth cache root. (Indexing begins at 0.)

Returns true for success, false for failure.

// key is a string (input)
// Returns a boolean value
IsCached( key )

Returns true if the item is found in the cache, otherwise returns false.

// filename is a string (input)
// Returns a boolean value
SaveLastError( filename )

Saves the last error information to an XML formatted file.

// key is a string (input)
// expireDateTime is a SYSTEMTIME object (output)
// eTag is a string (input)
// itemData is a CkByteData object (output)
// Returns a boolean value
SaveToCache( key, expireDateTime, eTag, itemData )

Inserts or replaces an item in the cache. The eTag is optional and may be set to a zero-length string. Applications may use it as a place to save additional information about the cached item. The Chilkat HTTP component, when caching a page, writes the eTag (entity-tag) from the HTTP response header to this field.

Returns true for success, false for failure.

// key is a string (input)
// eTag is a string (input)
// itemData is a CkByteData object (output)
// Returns a boolean value
SaveToCacheNoExpire( key, eTag, itemData )

Inserts or replaces an item in the cache. The cached item will have no expiration. The eTag is optional and may be set to a zero-length string. Applications may use it as a place to save additional information about the cached item.

Returns true for success, false for failure.

// key is a string (input)
// expireDateTime is a SYSTEMTIME object (output)
// Returns a boolean value
UpdateExpiration( key, expireDateTime )

Updates the expire date/time for a cached item.

Returns true for success, false for failure.

// key is a string (input)
// Returns a string
getEtag( key )

Returns the eTag for an item in the cache.

// key is a string (input)
// Returns a string
getFilename( key )

To be documented soon.

// index is an integer (input)
// Returns a string
getRoot( index )

Returns the directory path of the Nth cache root. (Indexing begins at 0.)

// Returns a string
lastErrorHtml( )

Error information in HTML format for the last method called.

// Returns a string
lastErrorText( )

Error information in plain-text format for the last method called.

// Returns a string
lastErrorXml( )

Error information in XML format for the last method called.

// Returns a string
lastEtagFetched( )

The ETag of the last item fetched from cache.

// Returns a string
lastKeyFetched( )

The key of the last item fetched from cache. (For web pages, the key is typically the canonicalized URL. Otherwise, the key is a unique identifer used to access the cached item.)