cache.getCache(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Checks for a cache object with the specified name. If the cache exists, this method returns the cache object. If the cache does not exist, the system creates a cache and returns the created cache object.

Returns

cache.Cache

Supported Script Types

Server scripts

For additional information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/cache Module

Sibling Module Members

N/cache Module Members

Since

2016.2

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.name

string

required

The name of the cache to be retrieved or created. The maximum size of the cache name is 1 kb.

options.scope

string

optional

Sets the availability of the cache. A cache can be made available to the current script only, to all scripts in the current bundle, or to all scripts in your NetSuite account.

Set this value using the cache.Scope enum. The default value is cache.Scope.PRIVATE.

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/cache Module Script Samples.

          //Add additional code 
...
var myCache = cache.getCache({
    name: 'temporaryCache',
    scope: cache.Scope.PUBLIC
});
...
//Add additional code 

        

Related Topics

N/cache Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices