By default the firebase remote config cache expires after 12 hours, but i want to know what is the minimum cache Expiration time for firebase remote config.
How does it work? Remote Config includes a client library that handles important tasks like fetching parameter values and caching them, while still giving you control over when new values are activated so that they affect your app's user experience.
Using the Remote Config background function triggering provided by Cloud Functions for Firebase along with FCM, you can propagate Remote Config updates in real-time.
Firebase Remote Config is a cloud service that lets you change the behavior and appearance of your app without requiring users to download an app update. When using Remote Config, you create in-app default values that control the behavior and appearance of your app.
There is no minimum cache expiration time recommended by Firebase. However, please note that if the calls to Firebase Remote Config are too frequent then they will be put on hold for some time. This is done to optimize the network usage by Remote Config feature.
To be frank, 10 min is too small a time to set. Remote Config feature should be used for values that you need to change less frequently. 12h (the default) is a good time to set. You can maybe reduce it to 1h. But I'd not advice you to further reduce this time duration.
In case you really need to update your data more frequently, and you do not want your update request to be put on hold by Firebase for some time, you should consider using Firebase Database instead which has no such limit, and is realtime.
By default cache expiration time set to 12 hours.
Hitting Firebase remote config too many times will put the request on hold.
While you are implementing/testing the functionality you can set it to any value to get the updated result from firebase. However it is not recommended in production mode
You can do something like this.
// 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
}
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With