Client cache service

Since Sculptor version

6.2.0

Idea

The idea is to cache the remote data in a local keyed file. The remote data may be coming from SQL/ODBC or sculptor keyed files.

The cache is useful when reading a file without a lock. And better when the remote file is not modified a lot (as the refresh check frequency can be reduced)

How to configure

To specify the file to cache and the type of cache to use a new set of attributes has been added to the ![o]file object.

The interface to the service has been implemented only in the Sculptor interpreters sage[c,w,wc,wcd]/srep[c,w,wc,wcd]

Refresh

If the cache data source is updated by other processes, the cache has to be discarded and reloaded. This process is called refresh. The refresh process can be cofigured with the ![o]file cache_auto_refresh attributte or manually triggered with the refresh_cache command.

Access or All cache

There are two types of cache with regard to how the file cache is filled:

  1. All cache Filled with all the source data when it is first opened from the source (KfServer or ODBC source). Defined using the CACHE_ALL on the ![o]file cache_option attributte.

  2. Access cache Filled with data when it is first fetched from the source (KfServer or ODBC source). Defined using the CACHE_ACCESS on the ![o]file cache_option attributte.

With an Access cache when a read operation in the cache fails, it tries to fetch it on the source, while on the All cache when a read fails, the read returns NSR.

The next, prev, find, match, count,… take profit of an All cache but not an Access cache.

Shared cache

When the CACHE_SHARED is specified on the ![o]file cache_option attributte, the cache is going to be a file shared between clients (different programs) running on the same machine that define the same data source as shared. Making a more efficient use of the network, file system and memory.

The shared cache’s metadata is going to be stored in that KeyedFile $SCULPTOR\clientcache\sharedclientcachedb.d;

KEY FIELDS

1:sc_source_type1

i4

Remote data source type

2:sc_server2

a48

Remote server

3:sc_database2

a32

Remote database

4:sc_table2

a96

Remote table or filename

DATA FIELDS

5:sc_cache_option

i4

Include or exclude

5:sc_cache_option

i4

Include or exclude

5:sc_cache_option

i2

CACHE_ALL or CACHE_ACCESS

6:sc_cache_filename

a32

Inside $SCULPTOR/clientcache/data

7:sc_update_id3

b32

source_type dependent update Id

8:sc_status

i2

Current cache status

9:sc_last_open

d4

Last open date

10:sc_count_open

i4

Number of opens

1

sc_source_type: Sculptor, ODBC SQLS, ODBC Oracle…

2(1,2,3)

sc_server, sc_database and sc_table: May change between different remoteType’s

3

sc_update_id: Is used to store information to find out if the remote source has been changed since last refresh.

There is a program in the same directory to manage the shared client caches:

$SCULPTOR\clientcache\sharedclientcachemgt.r

Example

An example is provided to show the use of the client cache.