Manage the Codings Cache

Answer Server uses a cache of codings data to improve performance when it is retrieving the codings. As well as caching valid codings, it caches a 'not found' entry when it looks up an entity that does not exist, to prevent multiple unsuccessful lookups for the same thing.

By default, Answer Server removes old entries from the cache only when it runs out of allocated space. When you do not update the codings information very often, this option is fine. However, if you update the codings regularly and want Answer Server to pick up the changes in a timely manner, you might need to update the cache more frequently.

You can configure Answer Server to automatically remove old items from the cache when you use an ODBC codings database. You can also use a ManageResources action to manually reload the codings.

Expire Codings Cache Entries Automatically

You configure automatic codings cache expiration by using the CacheExpirationInterval and CacheNotFoundExpirationInterval parameters, which you set in the CodingsConfigSection (see Configure the Fact Bank System).

NOTE: You can use automatic codings expiration only when you use the ODBC codifier type (see Set up a SQL Database for Coding Information).

The CacheExpirationInterval parameter controls how long to keep entries for valid codings in the cache. The CacheNotFoundExpirationInterval parameter controls how long to keep entries for entities that were not found.

Depending on your use case, it is probably more common that you add new entries to the codings database rather than modifying the existing values. In this case, you might want to set CacheNotFoundExpirationInterval to be more frequent than CacheExpirationInterval.

For example:

[MyFactBank]
CodifierType=ODBC
CodingsConfigSection=MyCodifiers
...
[MyCodifierSection]
CacheExpirationInterval=86400
CacheNotFoundExpirationInterval=43200

For more information about these configuration parameters, refer to the Answer Server Reference.

Update the Codings Database Manually

You can reload the coding database manually by using the ManageResources action. This option updates the codings values for all codifier types:

  • When CodifierType is odbc, Answer Server removes all current cached coding lookups.
  • When CodifierType is files, Answer Server reloads the coding maps from disk to reflect any changes. It uses the raw text files if they are present, or the generated dat files otherwise.

For example:

Action=ManageResource&SystemName=FactBank
data={
   "operation":"reload",
   "type":"codifier"   
   }

You can retrieve the full schema for the JSON object to use by using the GetResources action. See Find the JSON Schema for Your Update.

NOTE: The ManageResources action fails if you attempt to use request JSON that contains properties that are not contained in the appropriate schema.