the query is on encrypted cache, while working with encrypted cache we have few operations
among all these operations, which and all require the connection to Worklight server?
This topic has been locked.
Pinned topic query on encrypted cache
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Re: query on encrypted cache2013-01-03T13:29:06ZThis is the accepted answer. This is the accepted answer.Hi Meduri,
Only the "open" operation requires connection to Worklight Server.
Others doon't need Worklight Server connection.
Re: query on encrypted cache2013-01-03T14:32:05ZThis is the accepted answer. This is the accepted answer.I recommend you take a look at JSONStore (new in Worklight 5.0.5) if you only need to support Android and iOS. You can use it without the data sync feature if you want, just like the Encrypted Offline Cache. The API is a bit better (IMO) and it doesn't use LocalStorage to persist data which could cause you issues.
JSONStore API Doc + Overview
Module 7.9 - Overview of JSONStore
Module 7.10 - Using JSONStore / Exercise and code sample
Module 7.11 - JSONStore with Synchronization / Exercise and code sample
Module 7.12 - JSONStore with Security / Exercise and code sample
Re: query on encrypted cache2013-01-03T15:32:03ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK
1) does it too require the connection to backend always?
2) can we use it for offline cache? or once the application is reloded, do we lose the data wahtever we saved in the JSON store?
Re: query on encrypted cache2013-01-04T12:30:25ZThis is the accepted answer. This is the accepted answer.
- MuraliK,Meduri 270003NCSH
Both Encrypted Cache and JSONStore require a connection to the Worklight Server -only- the first time you start them -if- you enable encryption, this is because you need a "Random String" from the server to generate the necessary keys to encrypt data. After that first time as long as you are not sending anything to the server, you can work fully offline. Also note that selecting encryption is optional in JSONStore but you don't have a choice when opening a new Encrypted Cache since that one is meant to always provide encryption. Weather or not to use encryption depends on your needs, for example if you're storing application settings like the background color the user picked on the settings page of your application you shouldn't really need it. However, if you're storing sensitive information like bank or medical information you should enable it.
"2) can we use it for offline cache? or once the application is reloded, do we lose the data wahtever we saved in the JSON store?"
Yes, you can use it to store data for offline use. No, you won't lose that data unless you chose to delete it or the user removes your application from their iOS or Android device.
The code explained in this module:
and shown in this example:
is very simple and straight forward. Hence, I highly recommend you run it on your Android or iOS device. You can store data, re-open the app and it should still be there, you can also go offline and access your data as long "connectOnStartup" is set to "false" in initOptions.js.
Re: query on encrypted cache2013-01-04T16:11:21ZThis is the accepted answer. This is the accepted answer.
Re: query on encrypted cache2013-01-04T16:39:30ZThis is the accepted answer. This is the accepted answer.
- MuraliK,Meduri 270003NCSH
Every Worklight Application can have just one JSONStore, but you can have many collections inside that JSONStore. For example:
- 1 collection that holds your user settings
- 1 collection that holds user comments
- 1 collection that holds ... and so forth
If you have an app that will be used by multiple users (just an example of a use case where you may want multiple JSONStores) you should probably:
- push the data saved to the backend (see push() and pushSelected())
- destroy the collection or the whole JSONStore (see destroy() and removeCollection())
- create a new one for the new user (see initCollection())
- get data for the new user (see load())
You should submit a feature request if you want multiple JSONStores per Worklight Application:
I believe the idea behind having just a one JSONStore per Worklight App is that usually a smartphone belongs to just one user and it's unlikely that many users will login into that smartphone app. Unlike, for example, web and desktop applications.