如何解决React-native Firebase 远程配置从不使用缓存
远程配置总是从服务器获取 我的设置远程配置:
async conf() {
await remoteConfig().setDefaults({
test_variable: 'default',});
const fetchedRemotely = await remoteConfig().fetchAndActivate();
if (fetchedRemotely) {
console.log('Configs were retrieved from the backend and activated.');
} else {
console.log(
'No configs were fetched from the backend,and the local configs were already activated',);
}
}
获取值:
const testVar = remoteConfig().getValue('test_variable');
if (testVar.getSource() === 'remote') {
console.log('Parameter value was from the Firebase servers.');
} else if (testVar.getSource() === 'default') {
console.log('Parameter value was from a default value.');
} else {
console.log('Parameter value was from a locally cached value.');
}
我总是得到
参数值来自 Firebase 服务器。
所以源来自“远程”,而不是来自“缓存”或“默认” 尽管默认情况下它应该缓存 12 小时。我不能经常做请求。 我做错了什么?有什么帮助吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。