If your PDF is generated with different data then it's a different PDF. The point of uniqueID is to identify a binary version of document.
- uniqueId
- Type: System.String
The unique identifier that will be used for generating the cache key for this document. For instance, it can be an ID from your database table or a simple file name; you just need to make sure this ID varies for each different document so that they are cached correctly. For example for files on disk, we internally use a string combination of file extension, file size and file date for uniquely identifying them, this way cache collisions do not occur and we can resuse the cached file even if the file name before extension is changed (because it's still the same document).
So you need to vary your uniqueID, otherwise same cache key will be generated and already cached version will be loaded. As you would notice uniqueID is a string so you can vary it as you would like, e.g. append a version number or DateTime.Now.Ticks.
Regarding cache lifetime of a file:
CacheMaxDays |
Gets or sets the maximum number of days to store cached documents. The default value is 90 days.
|
For example if you set
DocumentUltimateWebConfiguration.Current.CacheMaxDays = -1;
Then a cache file would immediately expire and when next request comes it would be deleted.
So if your generated PDF files are short-lived you can use this setting to prevent keeping all versions of the PDF file cached.