Skip to main content
Solved

SDK Cache

  • November 17, 2021
  • 3 replies
  • 569 views

Forum|alt.badge.img+5

In the SDK docs it is mentioned that the SDK caches user information. What is the TTL on the cache information? How stale can the information get? If a user leaves the app in the background for a few days does the SDK refetch information when the app is opened back up?

 

https://docs.revenuecat.com/docs/purchaserinfo#get-user-information

 

 

Best answer by ryan

Hey @Omer Winrauke!

The cache is 5mins, so when the app fires up or getPurchaserInfo is called a network request is made if the cache is >5mins stale.

However, it’s worth noting that the PurchaserInfo in the cache is always returned first. If a network request needs to be made this is done in the background. The reason for this is so you can check the purchaserInfo as often as you need and it will always return fast, creating a synchronous experience for your customers. 

View original
Did this post help you find an answer to your question?
This post has been closed for comments

3 replies

ryan
RevenueCat Staff
Forum|alt.badge.img+9
  • RevenueCat Staff
  • 391 replies
  • Answer
  • November 18, 2021

Hey @Omer Winrauke!

The cache is 5mins, so when the app fires up or getPurchaserInfo is called a network request is made if the cache is >5mins stale.

However, it’s worth noting that the PurchaserInfo in the cache is always returned first. If a network request needs to be made this is done in the background. The reason for this is so you can check the purchaserInfo as often as you need and it will always return fast, creating a synchronous experience for your customers. 


ricsantos
Forum|alt.badge.img+1
  • New Member
  • 4 replies
  • March 2, 2022

Hi, is it possible to get `CustomerInfo` from the cache without a network call?

Eg on app launch, it would be great to have immediate access to the most recent `CustomerInfo` object.

Currently I am calling `Purchases.shared.getCustomerInfo` on app launch but it returns async after a network call.

It looks like `Purchases.shared.customerInfoManager.lastSentCustomerInfo` might be the place but it is private.

https://docs.revenuecat.com/docs/purchaserinfo


Forum|alt.badge.img+6
  • Dedicated Member
  • 29 replies
  • April 30, 2022

Does this cach persistis after the app is closed and reopened again without internet connection?

Like, suppose the app is launched with an active internet connection, in which case RevenueCat’s SDK will fetch CustomerInfo and then cache it. Then suppose the app is closed and reopened some time later, now without an active internet connection. Will the cached data be available in this scenario?


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings