Options
All
  • Public
  • Public/Protected
  • All
Menu

缓存库 (有逻辑判断 是小程序 还是 h5)

Hierarchy

  • WowooCache

Index

Constructors

Properties

Methods

Constructors

constructor

  • new WowooCache(prefix?: string, expires?: any): WowooCache
  • 构造函数

    Parameters

    • Optional prefix: string

      项目前缀

    • Optional expires: any

      默认缓存时间单位秒

    Returns WowooCache

    [description]

Properties

expires

expires: number = 3600

默认过期时间

prefix

prefix: string = 'wowoo:'

默认前缀

Methods

clear

  • clear(): void
  • 清除所有缓存

    Returns void

get

  • get(name: string): Promise<null | string>
  • 获取缓存内容

    Parameters

    • name: string

      缓存键名

    Returns Promise<null | string>

remove

  • remove(name: string): Promise<unknown>
  • 移除一个缓存

    Parameters

    • name: string

    Returns Promise<unknown>

    [description]

set

  • set(name: string, value: any, expires?: any): Promise<unknown>
  • 设置缓存

    Parameters

    • name: string

      缓存名

    • value: any

      缓存值

    • Optional expires: any

      缓存时 间不传使用默认时间

    Returns Promise<unknown>

    成功返回true, 失败返回false