PTRecentlyUsedCache
@interface PTRecentlyUsedCache : NSObject
RecentlyUsedCache
RecentlyUsedCache is a persistent cache that provides thumbnails for recently
used documents in PDFNet. The cache is stored in the PDFNet Resources folder,
which can be set by calling PDFNet::SetPersistentCachePath. The cache will be used by
any PDFNet process that uses the resource path. If more than one PDFNet process
is running concurrently, the first process to acquire a lock on the cache will
use it. Subsequent processes will not read or modify the cache.
Recently used cache will track the order of N recently used documents, and store
references to generated PNG thumbnails for those documents. Most of this functionality
happens 'magically', without any necessary user action.
-
Removes the document from the recently used list
Declaration
Objective-C
+ (void)RemoveDocument:(NSString *)document_path;
Swift
class func removeDocument(_ document_path: String!)
Parameters
document_path
path to the document to remove.
-
Marks the document as having been accessed. This happens implicitly when calling PDFViewCtrl::SetDoc, but depending on your use case, you may also want to call it explicitly.
Declaration
Objective-C
+ (void)AccessDocument:(NSString *)document_path;
Swift
class func accessDocument(_ document_path: String!)
Parameters
document_path
path to the document being accessed.
-
Get the path to the thumbnail PNG associated with the document. Even if the document is in the recently accessed list, there is no guarantee it will have an associated PNG.
Declaration
Objective-C
+ (NSString *)GetBitmapPathIfExists:(NSString *)document_path;
Swift
class func getBitmapPathIfExists(_ document_path: String!) -> String!
Parameters
document_path
path to the document whose bitmap you want to retrieve.
Return Value
the path to the PNG bitmap, if it exists. Otherwise, an empty string.
-
Blast away the cache from the disk completely, removing any thumbnails and recently used state. You may want to do this if you detect some kind of corruption, or if the user wants to clear out disk space used by your application.
Declaration
Objective-C
+ (void)ResetCache;
Swift
class func resetCache()
-
Initialize the Recently used cache with the provided limits. If the cache already exists, it will shrink to conform to these limits immediately.
Declaration
Objective-C
+ (void)InitializeRecentlyUsedCache:(unsigned long)num_documents max_absolute_space:(unsigned long)max_absolute_space max_percentage_space:(double)max_percentage_space;
Swift
class func initializeRecentlyUsedCache(_ num_documents: UInt, max_absolute_space: UInt, max_percentage_space: Double)
Parameters
num_documents
the number of documents to track in the recently used list.
max_absolute_space
the maximum space, in bytes, the thumbnails can occupy on disk.
max_percentage_space
the maximum percentage of free space, in range 0 - 1.0, the thumbnails can occupy on disk.
-
Undocumented
Declaration
Objective-C
- (instancetype)init;
Swift
init!()