全局缓存 Cache

通用缓存

设置缓存

  • cb.cache.set('cacheName','value')
cb.cache.set('cacheName','value')

设置批量缓存

  • cb.cache.setAll('obj')
// 参数是要缓存的集合
cb.cache.setAll({
    'a':'1',
    'b':'2'
})

获取缓存

  • cb.cache.get('name')
// 无论是设置批量缓存/单个缓存,获取的方式都是取存储的key值
cb.cache.get('name')

删除缓存

  • cb.cache.clear()
// 删除全部缓存
cb.cache.clear()

// 删除指定缓存
cb.cache.clear('cacheName')

获取领域基础地址

  • cb.cache.baseUrls.get()
// 获取缓存
cb.cache.baseUrls.get('domainKey')

接口地址缓存

  • 扩展脚本调用扩展接口时,需要先清除接口地址缓存,再调用,否则会走缓存中的地址
  • cb.cache.cacheUrls.clear()
// 获取缓存
cb.cache.baseUrls.clear()

模板ID缓存

  • 清除模板ID缓存
  • cb.cache.cacheTplids.clear()
// 获取缓存
cb.cache.cacheTplids.clear()
Copyright © 用友 -【生态技术部】 2022-2023 all right reserved,powered by Gitbook修订时间: 2024-02-02 12:53:38

results matching ""

    No results matching ""