All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pdftron::Common::RecentlyUsedCache Class Reference

#include <RecentlyUsedCache.h>

Static Public Member Functions

static void RemoveDocument (const UString &document_path)
static void AccessDocument (const UString &document_path)
static UString GetBitmapPathIfExists (const UString &document_path)
static void ResetCache ()
static void InitializeRecentlyUsedCache (size_t num_documents, size_t max_absolute_space, double max_percentage_space)

Detailed Description


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.

Definition at line 31 of file RecentlyUsedCache.h.

Member Function Documentation

static void pdftron::Common::RecentlyUsedCache::AccessDocument ( const UString document_path)

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.

document_pathpath to the document being accessed.
static UString pdftron::Common::RecentlyUsedCache::GetBitmapPathIfExists ( const UString document_path)

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.

document_pathpath to the document whose bitmap you want to retrieve.
the path to the PNG bitmap, if it exists. Otherwise, an empty string.
static void pdftron::Common::RecentlyUsedCache::InitializeRecentlyUsedCache ( size_t  num_documents,
size_t  max_absolute_space,
double  max_percentage_space 

Initialize the Recently used cache with the provided limits. If the cache already exists, it will shrink to conform to these limits immediately.

num_documentsthe number of documents to track in the recently used list.
max_absolute_spacethe maximum space, in bytes, the thumbnails can occupy on disk.
max_percentage_spacethe maximum percentage of free space, in range 0 - 1.0, the thumbnails can occupy on disk.
static void pdftron::Common::RecentlyUsedCache::RemoveDocument ( const UString document_path)

Removes the document from the recently used list

document_pathpath to the document to remove.
static void pdftron::Common::RecentlyUsedCache::ResetCache ( )

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.

The documentation for this class was generated from the following file: