Welcome!

APIs for the Internet of Things

Max Katz

Subscribe to Max Katz: eMailAlertsEmail Alerts
Get Max Katz via: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Blog Feed Post

Using Appery.io In Memory Data (Cache) to Make Your App Run Faster

With Appery.io Database (part of Backend Services) you can store any app data. The database is instantly exposed via REST APIs to retrieve, create and search data. The database comes with out-of-the-box user management, files collection, and devices collection to send targeted push messages.

Appery.io offers another place to store data called: In Memory Data (IMD). This is basically a very fast cache where you can store data for a limited amount of time. Accessing this cache is about 10 times faster than accessing the database. Any data data in cache will be automatically removed after 20 minutes so you don’t need to worry about clearing the cache.

When working with data that doesn’t need to be persisted for a long time, you want to use this storage because it is very fast. For example, let’s say you generate a code that the user has to enter to confirm his/her account. Such code usually has a limited life span, so you can use In Memory Data to store it there. Another example if you need Server Code scripts to share data. Any script can access this data fast (think of this as very fast local storage with limited time for scripts).

The IMD uses key/pair and has a very simple API that allows you to add, lookup and remove data from the cache. The API is part of Server Code. Below is an example inserting, checking the size and deleting items from the cache.

// save
IMD.put("confirmCode", "123456789");

// check size
console.log("after insert: " + IMD.length()); // result 1

// delete 
IMD.remove("confirmCode");

// check size again
console.log("after delete: " + IMD.length()); // result 0

You can learn more about the IMD API here.

Using this cache is simple and you get a very fast access to data. Any Server Code script is Build a Mobile App with Custom API Backend in 5 Minutes that you can use in in a mobile app.


Read the original blog entry...

More Stories By Max Katz

Max Katz heads Developer Relations for Appery.io, a cloud-based mobile app platform. He loves trying out new and cool REST APIs in mobile apps. Max is the author of two books “Practical RichFaces” (Apress 2008, 2011), DZone MVB (Most Valuable Blogger), and is a frequent speaker at developer conferences. You can find out what Max is up to on his blog: http://maxkatz.org and Twitter: @maxkatz.