API / $cache.set

Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time. the driver supports TTL then the library may set a default value for it or let the driver take care of that. MUST be thrown if the $key string is not a legal value.

Name Type Description
$key string The key of the item to store.
$value mixed The value of the item to store, must be serializable.
$ttl null|int|\DateInterval Optional. The TTL value of this item. If no value is sent and
Type Description
bool True on success and false on failure.