Over a million developers have joined DZone.

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

Download Forrester’s “Vendor Landscape, Application Performance Management” report that examines the evolving role of APM as a key driver of customer satisfaction and business success, brought to you in partnership with BMC.

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.

See Forrester’s Report, “Vendor Landscape, Application Performance Management” to identify the right vendor to help IT deliver better service at a lower cost, brought to you in partnership with BMC.

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

Published at DZone with permission of Max Katz, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}