←Select platform

LoadFromCache(LoadFromCacheOptions) Method

Summary

Loads a previously saved document from the specified cache.

Syntax
C#
VB
C++
public static LEADDocument LoadFromCache( 
   LoadFromCacheOptions options 
) 
Public Shared Function LoadFromCache( 
   ByVal options As LoadFromCacheOptions 
) As LEADDocument 
public:  
   static LEADDocument^ LoadFromCache( 
      LoadFromCacheOptions^ options 
   ) 

Parameters

options

Options identifying the document to load.

Return Value

The document object if found in the cache; otherwise, null.

Remarks

Use this method to load a document previously stored in the cache with SaveToCache.

The options parameters must contain the document ID in the LoadFromCacheOptions.DocumentId property and the cache containing it in LoadFromCacheOptions.Cache.

The document will be re-loaded and populated exactly as it was during the time it was saved. If the document was originally created by using LoadFromFile, then the original file must still exist and can be accessed. If the document was originally created by using LoadFromUri, LoadFromUriAsync, or Create, then the library had copied the original file into the cache and is no longer being used. The document can be re-constructed even if the original file is deleted. If this document was originally created by using LoadFromStream, then the data stored in the stream was saved into the cache during SaveToCache, and the stream is no longer used and loading this document will act in the same manner as if it had been downloaded from an external URI.

This method can return null if the document was in the cache but has expired and was purged.

This method may also return null if the document was associated with a user token and the correct value was not passed in options*. Refer to InvalidUserTokenException for more information.

Saving and loading from the cache is useful if the document is to be re-used between sessions in your application. The document identifier (_documentId_) is all that is needed to store in order to re-construct the document after it was saved to the cache and disposed. This ID can be stored in a database or passed to the client side as in the case of the LEADTOOLS Document Web Service.

LoadFromCache supports loading a document that has been uploaded to the cache without calling LoadFromUri first.

Documents can be manually deleted from the cache at any time by calling DocumentFactory.

Requirements
Target Platforms
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.