Top  Previous  Next


The FLUSH.DH.CACHE statement flushes the dynamic file cache.








To improve performance of applications that repeatedly open and close the same files, closing a dynamic hashed file does not immediately close it at the operating system level. Instead, the file is moved into a cache of recently closed files from where it can be reopened at the application level very quickly. The size of this cache is determined by the DHCACHE configuration parameter. On reaching this limit, the oldest file in the cache is closed at the operating system level.


Sometimes an application may do something that will fail if the file is still open in the cache, perhaps in another process. Built-in QM operations such as using OSDELETE to delete a file will automatically flush the cache in all QM processes. Where the operation is not a built-in part of QM, the FLUSH.DH.CACHE statement can be used to cause all QM processes to close files that are in their cache.


Note that this action is asynchronous and it may take a few seconds for the request to be handled in all other QM processes. The FLUSH.DH.CACHE statement will wait for other processes to acknowledge that they have seen the request, with a timeout after four seconds. The NO.WAIT qualifier causes the program to continue without waiting.


When used with the LOCAL option, only the file cache of the process in which this statement appears is flushed.


Excessive use of the FLUSH.DH.CACHE statement can have a detrimental effect on performance.