Clear Metadata Cache
Metadata Server, SuperWEB2 and the Open Data API all store metadata information in a cache so that they do not have to keep querying the database. If you make changes to your metadata, you will need to clear these caches in order to see the changes in the SuperSTAR clients.
To ensure that you have completely cleared the cache, do the following:
- Run
metadata_cacheflush
to clear the Metadata Server cache (either for a specific database or all databases). - Flush the SuperWEB2 cache by accessing the
/webapi/rest/metadata/flushCache
REST endpoint as an authenticated administrator user. - (If applicable) flush the Open Data API cache by sending a DELETE request to the
/webapi/rest/v1/metadata/cache
(you will need to send an API Key associated with an administrator user in the headers of your request).
Users will not see the changes until they logout and log back in again, or change languages.
Clear the Metadata Server Cache
To clear the Metadata Server cache, you either need to restart the Metadata Server, or use the supplied cache flush tool (metadata_cacheflush.exe). This tool is located in the SuperSERVER program files directory (by default, C:\Program Files\STR\SuperSERVER SA).
If users are currently logged in to one of the SuperSTAR clients when you clear the cache, then they may not see the updates to the metadata immediately. This is because the clients also cache a local copy of the metadata.
For example, users who are logged in to SuperWEB2 may not see the updates until the SuperWEB2 cache is also cleared and they log out and back in again. SuperCROSS users may not see the changes until they restart SuperCROSS.
Clear the Cache
To clear the cache, open a command prompt and change to the SuperSERVER program files directory, then run the tool using the following options:
metadata_cacheflush [ -s <server> ] [ -p <port> ] [ -d <dataset_id> ]
Where:
<server> | The name of the Metadata Server to connect to. If you do not specify a server, it will default to localhost . |
---|---|
<port> | The port the Metadata Server is listening on. If you do not specify the port, it will default to 8005 . |
<dataset_id> | The ID of the dataset to clear from the cache. If you do not specify a dataset ID then the cache will be cleared for all datasets. You can specify multiple datasets if necessary; separate the IDs with either a comma ( |
For example, the following command clears the cache for the bank
dataset, on the instance of Metadata server running on myserver
:
metadata_cacheflush -s myserver -d bank
The following examples clear the cache for the bank
and people
datasets:
metadata_cacheflush -d bank;people
Clear the Entire Cache
To clear the entire Metadata Server cache for all datasets, simply run the cache flush tool without the -d
option.
If your Metadata Server is running on localhost using the standard port number, then you can clear the entire cache by running the cache flush tool with no options at all.
Help using the Cache Flush Tool
The cache flush tool has a -h
option that you can use if you need to check the valid arguments:
metadata_cacheflush.exe -h
Clear the SuperWEB2 Metadata Cache
In addition to the Metadata Server cache, SuperWEB2 also caches some of the information it receives from Metadata Server. You may also need to clear this cache to see any changes reflected in the SuperWEB2 client.
To flush the SuperWEB2 cache, initiate a GET request to the following REST endpoint: /webapi/rest/metadata/flushCache
For example, if your SuperWEB2 is installed at http://myserver:8080/webapi/ then the full URL of the REST endpoint would be http://myserver:8080/webapi/rest/metadata/flushCache
Only administrator users (users who belong to the SuperADMIN group specified by the administratorGroup
parameter in web.xml) can use this REST endpoint to flush the cache. There are a number of ways you can provide the appropriate authentication:
- Log in to SuperWEB2 as an administrator user, then open the REST endpoint URL in the same browser. The endpoint will use your session cookie to validate your login. If you successfully call the endpoint you will see a blank page in your browser window.
- Use a REST client, such as Postman to access the REST endpoint using HTTP Basic Authentication.
Regardless of whether you manually clear the cache, SuperWEB2 will periodically refresh its cache of information from the metadata database. You can control how frequently this happens by editing the metadata.cacheSpec
setting in the configuration.properties file.
Clear the Open Data API Metadata Cache
If you are using the Open Data API, you may also need to flush the API metadata cache to ensure that any labels returned in API queries use the updated metadata.
Send an HTTP DELETE request to the following endpoint: /webapi/rest/v1/metadata/cache
In the headers of your request, you must include an APIKey
header that include the API key of an administrator user. See API Cache for more details.