Function setCache

  • Get the cache, if the deposited is Object, the retrieved is also Object, no need to convert again

    Type Parameters

    • T = unknown

    Parameters

    • name: string

      cache name

    • value: T

      cache data, can be passed directly into Object

    • Optionalseconds: string | number

      cache time (seconds)

    Returns void

    // set boolean
    setCache('boolean', true)

    // set object
    setCache('object', { name: 'saqqdy' })

    // set number, expires in 20 seconds
    setCache('number', 666, 20)

    1.0.2