Cache object method · N/cache
put()
Cache.put(options)
Puts a value into the cache.
- Implementation
- Not started
- Design
- Open for proposals suggest how it should read
A
suitescript api
1objCache.put({2 key: /* string, required */,3 value: /* string, required */,4 ttl: /* number, optional */5});
| Parameter | Type | Required | Description |
|---|---|---|---|
| options.key | string | required | The key corresponding to the value to be placed in the cache. This value cannot be null. For example, a ZIP code can used as the key for city names. The maximum length of a key is 4KB (4096) bytes. |
| options.value | string | required | The value to place in the cache. If the value is not a string, the system uses JSON.stringify() to convert the value before it is placed in the cache. The maximum size of the value is 500KB. |
| options.ttl | number | optional | The maximum duration, in seconds, that the value may remain in the cache. Note that the value may be removed before the ttl limit is reached. The minimum value is 300 (five minutes). If this option is not specified, there is no default maximum value. Important: A cached value is not guaranteed to remain in the cache for the full duration of the ttl value. The ttl value represents the maximum time that the cached value may be stored. Cached data is not persistent, so you should consider using the Cache.get(options) method with the options.loader parameter to set and retrieve data. |
B
mynt syntax
No Mynt syntax yet.
Nothing in the language compiles to Cache.put(options) today. How should it read?
C
community proposals
Competing syntax for put, from GitHub Discussions. Select two or more to compare them side by side.
Loading proposals from GitHub…
D
suggest an alternative
Write the Mynt you wish you could write.
A good proposal shows the syntax, the SuiteScript it should become, and argues for it: why it is clearer, how it fits the rest of the language, what it makes harder.
- Clarity. Does it say what happens, without ceremony?
- Consistency. Does it read like
load,saveandRef[field]? - Expressiveness. Does it cover the cases people actually write?
- Honesty. Does it hide a NetSuite cost, such as governance, that a reader should see?