ePages 7.37.0 - DE_EPAGES/TLE/API/SavedIncludesHandler.pm

Package DE_EPAGES::TLE::API::SavedIncludesHandler

Handles SavedIncludes for file templates (i.e. without PageTypes).

Functions

clearAllCaches
getRootCachePath
new
savePage

clearAllCaches

Deletes the directory where all "saved-includes" stored.

Syntax
$SavedIncludesHandler->clearAllCaches;

getRootCachePath

Returns the path of directory where all "saved-includes" stored. (e.g. "C:/epages/Shared/Static/SavedIncludes")

Syntax
$CachePath = $SavedIncludesHandler->getRootCachePath;
Return
$CachePath (string)
path to root directory

new

Creates a new SavedIncludesHandler object DE_EPAGES::TLE::API::SavedIncludesHandler

Syntax
$SavedIncludesHandler = DE_EPAGES::TLE::API::SavedIncludesHandler->new(
    RootDir => $RootDir
);
Input
$RootDir (string)
path to root directory for cached includes
Return
$SavedIncludesHandler (DE_EPAGES::TLE::API::SavedIncludesHandler)
cache handler

savePage

Save cache of actual object in File. Use static path of actual object. To save cache file the function will need a unique cachekey, this key is integrated in filename. Also a function to compute the content is needed. Content is computed if no cachefile exist.

Syntax
$Content = $SavedIncludesHandler->savePage($CacheKey, $FallBackSub);
Example
$Content = $SavedIncludesHandler->savePage('MBO.Menu_de',
sub{
    return join '', @{$Processor->replaceTLEs($cTemplate)};
});
Input
$CacheKey (string)
name or key must be unique for an object
$FallBackSub (sub)
function that generate and returns actual content
Return
$Content (content)
Content from cached file