Over a million developers have joined DZone.

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

DZone's Guide to

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

Want to make your app run faster? The Appery.io Database allows In Memory Data storage. Try using Appery.io in-memory to significantly improve performance.

· Performance Zone ·
Free Resource

Built by operators for operators, the Sensu monitoring event pipeline empowers businesses to automate their monitoring workflows and gain deep visibility into their multi-cloud environments. Get started for free today.

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.

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

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

// delete 

// 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.

Download our guide to mitigating alert fatigue, with real-world tips on automating remediation and triage from an IT veteran.

performance ,cache ,memory ,tricks ,in-memory ,appery.io ,app performance ,data cache ,memory cache

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}