赛捷软件论坛's Archiver

vicky.yu 发表于 2025-9-4 10:42

微信小程序 存储

存储
每个微信小程序都可以有自己的本地缓存,可以通过 wx.setStorage/wx.setStorageSync、wx.getStorage/wx.getStorageSync、wx.clearStorage/wx.clearStorageSync,wx.removeStorage/wx.removeStorageSync 对本地缓存进行读写和清理。

隔离策略
同一个微信用户,同一个小程序 storage 上限为 10MB。storage 以用户维度隔离,同一台设备上,A 用户无法读取到 B 用户的数据;不同小程序之间也无法互相读写数据。

清理策略
本地缓存的清理时机跟代码包一样,只有在代码包被清理的时候本地缓存才会被清理。

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.