Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Stores an object in cache.

void $Cache.Set(key: string, value: object)

Stores an object in cache with duration limit

void $Cache.Set(key: string, value: object, duration: string)

Arguments

string key
Key of value
object value
value to be stored
string duration
Expiration duration. Optional.

Remarks

If duration is not specified, object is stored as indefinitely until cache is cleared.

Duration can be specified in "day.hh:mm:ss" format.

Specifying value as null removes object from cache.

Example

Code Block
languagejs
var id = 1;
$Cache.Set("myObject:" + id, {
 Name : 'Madonna'
});

Example

Code Block
languagejs
var id = 1;
$Cache.Set("myObject:" + id, {
  Name : 'Madonna'
}, "12:00:00");