How to change cache refresh mode using a procedure in TIBCO Data Virtualization?

How to change cache refresh mode using a procedure in TIBCO Data Virtualization?

book

Article ID: KB0070295

calendar_today

Updated On:

Products Versions
TIBCO Data Virtualization 8.x and above

Description

In TIBCO Data Virtualization under Web Service Operations there is the updateResourceCacheConfig operation which can update the cache configuration for a resource. The updateResourceCacheConfig web service operation or any web service operations can be called in the procedure in TIBCO Data Virtualization so that this can be used to trigger the changes with a schedule.

Environment

All Supported OS

Resolution

Below is the sampling procedure that can change the cache refresh mode of a resource (/shared/examples/ds_orders/tutorial/orders) to Manual.

PROCEDURE CustomScript(OUT response XML, IN resource XML) 
BEGIN
    DECLARE fault XML;

    call /services/webservices/system/admin/resource/operations/updateResourceCacheConfig(resource,response,fault);

END
 

Then pass the below XML as the parameter which has the resource path, resource type, resource detail and refresh mode:

<resource:updateResourceCacheConfig xmlns:resource="http://www.compositesw.com/services/system/admin/resource" xmlns:common="http://www.compositesw.com/services/system/util/common">
  <resource:path>/shared/examples/ds_orders/tutorial/orders</resource:path>
  <resource:type>TABLE</resource:type>
  <resource:detail>SIMPLE</resource:detail>
  <resource:cacheConfig>
    <resource:refresh>
      <resource:mode>MANUAL</resource:mode>
    </resource:refresh>
  </resource:cacheConfig>
</resource:updateResourceCacheConfig>
 

After executing this, it will give the below response where the refresh mode can be verified as it has been set to Manual (<resource:mode>MANUAL</resource:mode>).

<resource:updateResourceCacheConfigResponse xmlns:resource="http://www.compositesw.com/services/system/admin/resource">
  <resource:cacheConfig>
    <resource:configured>true</resource:configured>
    <resource:enabled>true</resource:enabled>
    <resource:allOrNothing>true</resource:allOrNothing>
    <resource:incremental>false</resource:incremental>
    <resource:storage>
      <resource:useDefaultCacheStorage>true</resource:useDefaultCacheStorage>
      <resource:mode>DATA_SOURCE_OTPS</resource:mode>
      <resource:storageDataSourcePath>/lib/sources/defaultCacheDataSource</resource:storageDataSourcePath>
      <resource:bucketMode>AUTO_GEN</resource:bucketMode>
      <resource:bucketProperties>
        <resource:bucketSchema>ciscache</resource:bucketSchema>
        <resource:bucketPrefix>view70159_</resource:bucketPrefix>
        <resource:numBuckets>3</resource:numBuckets>
      </resource:bucketProperties>
      <resource:dropCreateIdx>true</resource:dropCreateIdx>
      <resource:storageTargets>
        <resource:entry>
          <resource:targetName>result</resource:targetName>
          <resource:path>/lib/sources/defaultCacheDataSource/ciscache/view70159_0</resource:path>
          <resource:type>TABLE</resource:type>
        </resource:entry>
        <resource:entry>
          <resource:targetName>result1</resource:targetName>
          <resource:path>/lib/sources/defaultCacheDataSource/ciscache/view70159_1</resource:path>
          <resource:type>TABLE</resource:type>
        </resource:entry>
        <resource:entry>
          <resource:targetName>result2</resource:targetName>
          <resource:path>/lib/sources/defaultCacheDataSource/ciscache/view70159_2</resource:path>
          <resource:type>TABLE</resource:type>
        </resource:entry>
      </resource:storageTargets>
    </resource:storage>
    <resource:refresh>
      <resource:mode>MANUAL</resource:mode>
    </resource:refresh>
    <resource:expirationPeriod>0</resource:expirationPeriod>
    <resource:clearRule>NONE</resource:clearRule>
  </resource:cacheConfig>
</resource:updateResourceCacheConfigResponse>
Note: The above XML response can be used as input XML to modify any configuration changes related to the Caching. The user needs to modify the configuration parameters as per the use case.

Issue/Introduction

This article explains on how to change the cache refresh mode using "updateResourceCacheConfig" in a procedure.

Additional Information

https://docs.tibco.com/pub/tdv/8.8.0/doc/html/en-US/StudioHelp/API/updateResourceCacheConfig_.html