...
The JSMA cache provides the following methods:
string cache.get(key, [force])
Retrieves value of the specified key if caching is enabled. If caching is disabled but you still wish to retrieve a value, you can set the force parameter to true.
...
Code Block | ||||
---|---|---|---|---|
| ||||
function renderContent(contentName, cacheable, expiry) { [...] var mappedContentName = PortalUtils.getRemappableAttribute(contentName); if (cacheable === "true" && (system.isDeveloperCacheActive || system.isCacheActive)) { var c = cache.get("portal.renderContent#" + mappedContentName, true); if (c) { return c; } } [...] } |
Parameter key:string (required)
The key the should be read out from cache
...
Code Block | ||||
---|---|---|---|---|
| ||||
function renderContent(contentName, cacheable, expiry) { [...] var content = contents.findByName(mappedContentName); [...] var res = content.content; if (cacheable === "true" && (system.isDeveloperCacheActive || system.isCacheActive)) { cache.set("portal.renderContent#" + mappedContentName, res, true, parseInt(expiry)); } return res; } |
Parameter key (required)
The key that should be set into cache
...