Modules
Objects/Functions
SuiteScript 2.0
{Cache}.get({key: {string*},loader: {function},ttl: {number}})
N/cache Module
Cache.get()
Method Description:
Retrieves a string value from the cache. The value retrieved is identified by a key that you pass by using the options.key parameter. If a requested value is not present in the cache, the system calls the function identified by the options.loader parameter. This user-defined function should provide logic for retrieving a value that is not in the cache. For an example, see N/cache Module Script Sample.
Returns:
String or null
Supported Script Types:
Server-side scripts
For additional information, see SuiteScript 2.0 Script Types.
Governance:
1 unit if the value is present in the cache; 2 units if the loader function is used
Module:
N/cache Module
Parent Object:
cache.Cache
Sibling Object Members:
Cache Object Members
Since:
2016.2
Search NetSuite -
https://system.netsuite.com/app/help/helpcenter.nl?search=Cache.get(options)
Example:
// Code Example 1
//Add additional code
//...
var myCache = cache.getCache({
name: 'temporaryCache',
scope: cache.Scope.PRIVATE
});
var myValue = myCache.get({
key: 'keyText',
loader: loader,
ttl: 18000
});
//...
//Add additional code
//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4642661440.html