CacheGroup

Description

Allows PowerBuilder to specify the name of the cache group used by PowerServer (2021, 2022, or later).

Applies to

ASE (ODBC)

MySQL

Oracle

PostgreSQL

SQL Server

SQL Anywhere (ODBC)

Syntax

CacheGroup='value'

Default value

The default value is "default", that is, CacheGroup='default', when the CacheGroup property is not specified.

Usage

You can define different cache groups (for example, groupA, groupB) that include the same set of cache names (for example, cache1, cache2) and caches of the same name in different groups can connect with the different databases, as shown in the example below.

Cache groups can be defined manually in the ServerAPIs project > AppConfig > Applications.json file in the PowerServer C# solution. For more information, refer to Using CacheGroup property.

 "Connections": {
    "default": {
    ...
    },
    "groupA": {
      "cache1": {
        "ConnectionType": "Odbc",
        "OdbcName": "sa-db1",
        "OdbcDriver": "SqlAnywhere",
        "UserID": "dba",
        "Password": "...",
        ...
      },
      "cache2": {
        "ConnectionType": "PostgreSql",
        "Database": "pgs-db1",
        "Host": "172.16.100.33",
        "Port": 5432,
        "UserID": "postgres",
        "Password": "...",
        ...
      },
      ...
    },
    "groupB": {
      "cache1": {
        "ConnectionType": "Odbc",
        "OdbcName": "sa-db2",
        "OdbcDriver": "SqlAnywhere",
        "UserID": "dba",
        "Password": "...",
        ...
      },
      "cache2": {
        "ConnectionType": "PostgreSql",
        "Database": "pgs-db2",
        "Host": "172.16.100.89",
        "Port": 5432,
        "UserID": "postgres",
        "Password": "...",
        ...
      },
      ...
    },
    ...
  }

Examples

In this example, if the login user is "companyA", then cache1 in groupA will be used to create the database connection, otherwise, cache1 in groupB will be used.

...
if username="companyA" then
   SQLCA.DBParm = "CacheGroup='groupA',CacheName='cache1'" 
else
   SQLCA.DBParm = "CacheGroup='groupB',CacheName='cache1'"
end if
...