transients

0.1.1 • Public • Published

JSON Transients

This plugin wraps the request module with a cache layer. Inspired by the WordPress Transients API.

setTransient

setTransient( name, url, cacheFor )

Returns false if the JSON request fails.

getTransient

Creates a transient object.

getTransient( name, callback( data ) [optional] )

Retrieves a transient object, makes a new request if the old on has expired, else returns cached Object.

Returns the transients data if no callback is provided.

Returns false if the transient was never set.

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i transients

    Weekly Downloads

    3

    Version

    0.1.1

    License

    MIT

    Last publish

    Collaborators

    • tdy721