|Security Definition Recovery||Table of Content||Advanced Programming|
|Product Definitions Cache|
This section provides information on how the Handler stores product definitions cache.
The ICE Exchange recommends client applications download product definitions only once per day and store them locally in some cache for reuse each time the client application needs to restart. The Handler allows to store, validate, and use the data in the product definitions cache file as recommended by ICE.
ProductDefinitionCacheDirectory parameter of the HandlerSettings class instructs the Handler where it should store product definitions cache files. By default, the value is empty, and this indicates that the product definitions cache should be disabled. But if it contains a valid path to a directory where the Handler can create product definitions cache files, the Handler activates the cache logic.
The Handler creates a product definitions cache file for each market subscription. This means that for each MarketSubscription object passed to Start(ICollection<MarketSubscription>) method the Handler creates a file with the following name:
For example, for market subscription for market type 5 with Futures security type and 2021, Dec 1st the Handler creates a file with the name:
This file contains raw binary data. This data represents payload received from TCP connection during receiving responses for corresponding product definition request. Each product definitions cache file contains data for only one type of securities.
Once started, the Handler checks if there are any product definitions cache files available. For the given market subscription, it looks for the cache files with the current dates and if it finds such a file, it starts the validation process. The validation includes checking the message type of each message in the file. Also, it includes checking that the number of messages is the same as NumOfMarkets field from the first message in the file. If any of these conditions is violated, the Handler ignores the cache file and refreshes it with the data from the network.