If you’re an android developer and you cache your objects then there’s a chance you’ve written code like this:

.doOnNext(users-> database.save(users));
doOnNext(posts-> database.save(posts));

And that’s the pretty version.

Image for post
Image for post

You end up writing each database query manually and as your code grows so does the manual work.

Wouldn’t it be nice to treat caching like a switch? Just say which objects you want cached and be done with it?

That’s what we’re gonna explore today!

Auto Caching

We’re gonna use Retrofit to make our http calls, gson for parsing and ObjectBox to cache the responses.

The idea is simple. Save every response annotated with @Cacheable directly into the database as a POJO, using Retrofit’s converter factory. …

Yesterday, i was reading a book about Benjamin Franklin. Some words, more than others caught my attention.

“I hate disputes”

In a letter from Benjamin Franklin to William Lee:

Sir, it is true i have omitted answering some of your letters. I do not like to answer angry letters.

I hate disputes.

I am old, cannot have long to live, have much to do and no time for altercation.

If i have often received and borne your magisterial snubbings and rebukes without reply, ascribe it to the right causes, my concern for the honour & success of our mission, which would be hurt by our quarrelling, my love of peace, my respect for your good qualities, and my pity of your sick mind, which is forever tormenting itself, with it’s jealousies, suspicious & fancies that others mean you ill, wrong you, or fail in respect for you…

Only the brave and the fool can overcome expectations. Everyone else has already decided.

Expectations define who we are and who we can be.

A job interview? A Date? Big plan ahead?

When faced with new and unfamiliar events we tend to create theories that are a product of our deepest fears and desires. When reality hits, we are emotionally charged and unable to see the situation clearly.

You could say that expectations are planning ahead with emotions. Removing emotions might not be possible, but you could certainly learn to manage them.

The lower the expectations the less you will be disappointed.



Software engineer. Building the world one line at a time @amuse_io

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store