Configure Least Recently Used Memory Cache - SuperWEB2
To use the Least Recently Used Memory Cache strategy with SuperWEB2 you need to configure the following parameters in the web.xml configuration file. This file is located in <tomcat_home>\webapps\webapi\WEB-INF\
Parameter | Configures | Available Options | Default |
---|---|---|---|
lruMapSize |
The size of the in-memory Least Recently Used map for storing table query results. | Any integer (indicates the number of stored table queries) |
30 |
systemTableCacheStrategy |
The cache strategy for system defined tables stored in webapi\WEB-INF\resources\txd. |
| NoCache |
otherTableCacheStrategy | The cache strategy for non-system defined tables. |
| NoCache |
To configure Least Recently Used Memory caching:
- Open web.xml in a text editor.
Make a backup copy of this file before making any changes.
-
Search for the Query Caching section:
CODE<!-- Query Caching Configuration --> <!-- 0 means never expire --> <context-param> <description>MemCached Server Cache Expiration Period</description> <param-name>memCachedServerExpiration</param-name> <param-value>0</param-value> </context-param> <context-param> <description>MemCached Server URL</description> <param-name>memCachedServerURL</param-name> <param-value>http://localhost:8091/pools</param-value> </context-param> <context-param> <description>In-memory cache LRUMap size</description> <param-name>lruMapSize</param-name> <param-value>30</param-value> </context-param> <!-- Available cache strategy options: CouchBaseMemoryPersistentCache - Couchbase MemCached persistent cache would be used. Required params: memCachedServerExpiration, memCachedServerURL, lruMapSize LRUMemoryCache - In-memory LRU cache would be used. Required params: lruMapSize NoCache - No caching would be used. --> <context-param> <description>System Table Cache Strategy</description> <param-name>systemTableCacheStrategy</param-name> <param-value>NoCache</param-value> </context-param> <context-param> <description>Cache Strategy for rest of tables</description> <param-name>otherTableCacheStrategy</param-name> <param-value>NoCache</param-value> </context-param>
-
Set lruMapSize to the number of table query results you want to cache in memory.
- Set systemTableCacheStrategy to LRUMemoryCache if you want to use LRUMemoryCache for predefined system tables.
- Set otherTableCacheStrategy to LRUMemoryCache if you want to use LRUMemoryCache for other tables.
If you set both systemTableCacheStrategy and otherTableCacheStrategy to use LRUMemoryCache, then they share the map size indicated in lruMapSize.