Time to Cache In!
The SAP ICM, or Internet Communication Manager, is what handles all communications between the SAP system and the great internet world using HTTP, HTTPS or SMTP protocols.
It has a cache mechanism that stores all web requests for the server so that end users experience faster response time. The problem is that often times custom applications have requirements that are restricted by the standard ICM setting.
One such example is when the custom application loads and reads images or other content stored on the server. Perhaps the images are modified regularly by users, and the changes need to be reflected immediately in the custom application. Due to the ICM’s standard mechanism, the changes aren’t reflected in the application until the cache entry for that content request has expired. The default expiration of ICM cache is 1 day, and this often exceeds the business requirement.
There are many ICM settings that can be leveraged to manipulate the cache as well as web requests. Here are two that I think can be used in many different scenarios:
1. Directing specific requests to a separate ICM cache with special settings
The default ICM cache is server_cache_0, and the cache entries are usually stored in /usr/sap/<SID>/<inst no>/data/cache. You can create additional cache locations for specific content by defining in the instance profile:
icm/HTTP/server_cache_1 = PREFIX=/specific/url/request/, CACHEDIR=/usr/sap/<SID>/<inst no>/data/cache/<newdir>
Additionally, leverage server_cache_<x> parameters such as icm/HTTP/server_cache_1/expiration to define specific settings for the new cache directory. Read more about it in the SAP library.
2. Manipulating content cache settings
icm/HTTP/file_access_<x> is a great way to manipulate the settings for accessing stored content, such as in the scenario I described above.
icm/HTTP/file_access_0 = PREFIX=/content/dir/alias/, DOCROOT=/actual/filesystem/directory/,CACHECTRL=+300,MAXAGE=+60
This ensures that the content stored in /actual/filesystem/directory/ accessed via the web through /content/dir/alias/ expires in the ICM cache after 5 minutes, and expires in the browser cache in 1 minute. So that any changes to the content can be reflected to the user in a proper amount of time.
Related content: SAP NetWeaver Java Cache Administration