1. https://appdevelopermagazine.com/ios
  2. https://appdevelopermagazine.com/linkedin-makes-rocket-data-open-source-so-you-can-cache-data-in-your-ios-apps-too/
8/4/2016 9:03:48 AM
LinkedIn Makes Rocket Data Open Source So You Can Cache Data in Your iOS Apps Too
LinkedIn App,Rocket Data,loadFromCache
/Linked-in-Rocket-Data-Open-Source-App-Developer-Magazine_oldrkeov.jpg
App Developer Magazine
LinkedIn Makes Rocket Data Open Source So You Can Cache Data in Your iOS Apps Too

iOS

LinkedIn Makes Rocket Data Open Source So You Can Cache Data in Your iOS Apps Too


Thursday, August 4, 2016

Peter Livesey Peter Livesey


Last year, LinkedIn began rewriting the LinkedIn flagship mobile application. The existing app had a number of challenges and hadn’t received a significant overhaul in some time. So we wanted the new version to not only look and feel updated, but also to have powerful infrastructure backend to support it.

As a part of that effort, we wanted a caching system that would present content to the user while data was loading from the network. Core Data, a commonly used modeling and database framework provided by Apple, offers one potential solution. Core Data is a powerful framework, but it pays for its power with complexity, and the framework is notorious for crashing applications when something goes wrong.

We also wanted to use immutable models, and Core Data’s programming model relies on mutability. We then looked at some other options, like a simple URL cache, Realm, or just serializing the models to disk, but none of these solutions addressed our requirements. 

So, we decided to develop our own caching solution, building Rocket Data, which is a non-blocking, immutable model management system with a persistent synchronization layer. And we recently announced that we open sourced it (Rocket Data on Github) as well.
 
Rocket Data has a simple API which easily hooks up to key-value stores and can use any cache. Each view controller has a reference to one or more data providers. There are two types of data providers: regular data providers and collection data providers. The data is easy to consume with simple accessors in both providers and access to the data is instant, since the models are always kept in memory.

Here’s an example application run to show how data flows through Rocket Data:


- The view controller calls loadFromCache on the data provider. This call is asynchronous so it will not block the main UI thread. When the data returns, the view controller is notified and it will rerender.

- The view controller receives fresh data from the server. The view controller sets this data on the data provider. The data provider then lazily propagates this to the cache and Consistency Manager, again on a background thread.

- Later in the application execution, a model is changed which affects our view controller. The Consistency Manager will notify the data provider which will update its data and notify the view controller so it can rerender.

By using Rocket Data, we’ve been able to easily add caching to all features within the new LinkedIn mobile app with very little additional work from developers. The cache and data providers are automatically kept consistent across screens, and we’ve never needed to add code for any migrations.

We believe other products could benefit from Rocket Data’s flexibility to work with multiple modeling and caching solutions and are looking forward to hearing how it is used by the community.




Read more: https://engineering.linkedin.com/blog/2016/07/rock...




This content is made possible by a guest author, or sponsor; it is not written by and does not necessarily reflect the views of App Developer Magazine's editorial staff.

Subscribe to App Developer Magazine

Become a subscriber of App Developer Magazine for just $5.99 a month and take advantage of all these perks.

MEMBERS GET ACCESS TO

  • - Exclusive content from leaders in the industry
  • - Q&A articles from industry leaders
  • - Tips and tricks from the most successful developers weekly
  • - Monthly issues, including all 90+ back-issues since 2012
  • - Event discounts and early-bird signups
  • - Gain insight from top achievers in the app store
  • - Learn what tools to use, what SDK's to use, and more

    Subscribe here



Featured Stories


Anthropic investigation opened after Mythos accessed by Discord group
Anthropic investigation opened after Mythos accessed by Discord group Wednesday, May 27, 2026


AI layoffS: What is really behind it all
AI layoffS: What is really behind it all Tuesday, May 26, 2026


The identity system is failing under AI
The identity system is failing under AI Monday, May 25, 2026




The Real World Launches Expert-Verified AI Certification Framework
The Real World Launches Expert-Verified AI Certification Framework Friday, May 22, 2026


Multiple language options when developing apps with Evoke
Multiple language options when developing apps with Evoke Thursday, May 21, 2026


When Social Listening Becomes Social Surveillance
When Social Listening Becomes Social Surveillance Wednesday, May 20, 2026


Medical debt relief custom-built platform moopFi launches
Medical debt relief custom-built platform moopFi launches Tuesday, May 19, 2026


Quant Pros Say AI Is Widening the Skills Gap
Quant Pros Say AI Is Widening the Skills Gap Monday, May 18, 2026


Tether QVAC SDK Powers AI Across Devices and Platforms
Tether QVAC SDK Powers AI Across Devices and Platforms Wednesday, April 22, 2026


APAC 5G expansion to fuel 347B mobile market by 2030
APAC 5G expansion to fuel 347B mobile market by 2030 Tuesday, April 21, 2026


Stay Updated

Sign up for our newsletter for the headlines delivered to you

SuccessFull SignUp

Get More App News



/sites/themes/prod/assets/js/less.js"> ' ' %>