Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Caching data in a connected world - VADG
Search
Iván Martín
March 23, 2017
Programming
0
160
Caching data in a connected world - VADG
Iván Martín
March 23, 2017
Tweet
Share
Other Decks in Programming
See All in Programming
CSC305 Lecture 08
javiergs
PRO
0
280
マンガアプリViewerの大画面対応を考える
kk__777
0
340
Domain-centric? Why Hexagonal, Onion, and Clean Architecture Are Answers to the Wrong Question
olivergierke
3
980
Google Opalで使える37のライブラリ
mickey_kubo
3
150
When Dependencies Fail: Building Antifragile Applications in a Fragile World
selcukusta
0
110
Vueのバリデーション、結局どれを選べばいい? ― 自作バリデーションの限界と、脱却までの道のり ― / Which Vue Validation Library Should We Really Use? The Limits of Self-Made Validation and How I Finally Moved On
neginasu
2
1.6k
他言語経験者が Golangci-lint を最初のコーディングメンターにした話 / How Golangci-lint Became My First Coding Mentor: A Story from a Polyglot Programmer
uma31
0
440
Six and a half ridiculous things to do with Quarkus
hollycummins
0
220
スマホから Youtube Shortsを見られないようにする
lemolatoon
27
34k
iOSでSVG画像を扱う
kishikawakatsumi
0
170
バッチ処理を「状態の記録」から「事実の記録」へ
panda728
PRO
0
190
Building, Deploying, and Monitoring Ruby Web Applications with Falcon (Kaigi on Rails 2025)
ioquatix
4
2.5k
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
Typedesign – Prime Four
hannesfritz
42
2.8k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
The Language of Interfaces
destraynor
162
25k
How to Ace a Technical Interview
jacobian
280
24k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
Building Adaptive Systems
keathley
44
2.8k
Docker and Python
trallard
46
3.6k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.2k
Context Engineering - Making Every Token Count
addyosmani
8
310
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
140
34k
Transcript
Caching data in a connected world Iván José Martín García
Github: seik Twitter: @seikv
Problema
Problema
Problema
Problema Vivimos en un mundo conectado.
Dependencias
RxJava
<Observable> •Clase principal en la programación reactiva. • Trabaja sobre
un “flujo de datos”. • .subscribeOn() • .observeOn() • Transformaciones.
Realm • Persistir datos de una forma simple. • Muy
fácil de implementar/mantener. • Rápido, muy rápido.
Realm A tener en cuenta
Realm Evaluación perezosa.
Realm Not thread safe.
Realm Object (Necesarios getters y setters)
Guardar datos 1. Obtenemos una instancia de Realm 2. Ejecutamos
una transacción donde guardamos nuestros datos. 3. Cerramos la instancia de realm si no la vamos a usar más.
Obtener datos 1. Obtenemos una instancia de Realm 2. Ejecutamos
una query. 3. Cerramos la instancia de realm si no la vamos a usar más.
Remote API Representación Local Repository
Local 1. Query. 2. Devolvemos el usuario como observable, si
no existe devolvemos un observable vacío.
Remote Llamamos al servicio y por cada item ejecutamos nuestra
función de guardado.
Repository 1. Nos suscribimos en el main thread. 2. Observamos
los cambios en el main thread.
Repository 1. Nos suscribimos en background. 2. Observamos los cambios
en el main thread.
Repository Concatenamos ambos Observables
Representación Manejamos los datos y mostramos un aviso si no
se ha podido mostrar información actualizada.
Representación Nos desuscribimos.
Demo
Demo
Demo https://github.com/Seik/vadg-caching-data
¡Muchas gracias!