Thank you for your question.
1. Cache invalidation works in the next way: Viewer takes date of the last document editing and compare it with the date of the cache files - if the cache older it will be regenerated.
2. In the Viewer we have DocumentCache class which can be used for cache generating and you not need to create your own function.
3. If you need the date syntax to stamp it to the folder of file name here it is:
string modificationTimeString =
modificationDateTime.ToString(“s”, CultureInfo.InvariantCulture).Replace(’:’, ‘_’);
and back to dateTime