firebase 远程配置的最短缓存过期时间是多少?

what is the minimum cache expire time for firebase remote config?

默认情况下,firebase 远程配置缓存在 12 小时后过期,但我想知道 firebase 远程配置的最小缓存过期时间是多少。

Firebase 没有建议的最短缓存过期时间。但是,请注意,如果对 Firebase Remote Config 的调用过于频繁,它们将被搁置一段时间。这样做是为了通过远程配置功能优化网络使用。

坦率地说,10 分钟的时间太短了。 Remote Config 功能应该用于您不需要经常更改的值。 12 小时(默认值)是设置的好时间。您也许可以将其减少到 1 小时。但是我不建议你进一步减少这个持续时间。

如果你真的需要更频繁地更新你的数据,并且你不希望你的更新请求被 Firebase 搁置一段时间,你应该考虑使用没有这种限制的 Firebase 数据库,并且是实时的。

默认缓存过期时间设置为 12 小时。

多次点击 Firebase 远程配置会暂停请求。

当您使用 implementing/testing 功能时,您可以将其设置为任何值以从 firebase 获取更新的结果。但是不建议在生产模式下使用

你可以这样做。

// cache expiration in seconds
long cacheExpiration = 3600;

//expire the cache immediately for development mode.
if (mRemoteConfig.getInfo().getConfigSettings().isDeveloperModeEnabled()) {
    cacheExpiration = 0;
}

// fetch info
mRemoteConfig.fetch(cacheExpiration)
    .addOnCompleteListener(this, new OnCompleteListener<Void>() {
        @Override
        public void onComplete(Task<Void> task) {
            if (task.isSuccessful()) {
                // task successful. Activate the fetched data
                mRemoteConfig.activateFetched();

                // update Views
            } else {
                //task failed
            }
        }
    });

请参阅 https://firebase.google.com/docs/remote-config/use-config-android#throttling - 我们更新了文档。

默认值:12 小时 您可以指定的最短时间:每 60 分钟 5 次 window