Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 444
Sarath Kumar Avatar asked Aug 06 '16 09:08

Sarath Kumar


People also ask

Does Firebase remote config cache?

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.

Is Firebase remote config real time?

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.

What is the use of Firebase remote config?

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.


2 Answers

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.

like image 90
mumayank Avatar answered Sep 28 '22 08:09

mumayank


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
            }
        }
    });
like image 31
Naveen T P Avatar answered Sep 28 '22 08:09

Naveen T P