简体   繁体   中英

Long-term persistence in Kynetx apps (via entity variables or something else)

I have an app that allows the user to enter a name and other relevant information to be used in submitting a request to a web service. I'd like to store that and use it to pre-fill the form the next time the app runs.

Entity variables would be great for this, except that in most cases I want the data to persist longer than just one session. It's not really a problem for them to enter it again every time, since the data is simple and not sensitive. But it would be nice to be able to hold on to that data as long as possible.

In a regular web app, I would just set a cookie with an expiration date of 3 months or something. Is there a way to use entity variables in this way (ie, longer than one session)?

I'm glad you ask because I think you may have misunderstood entity variables.

Entity variables are the correct thing to use for what you are trying to do.

Entity variables in KRL will persist for a user as long as the kobj.net cookie persists in their browser

替代文字

This means that if you use an entity variable to save a users name and other data, your app will still have access to that as long as that cookie is in their browser.

*THE FUTURE

In the future, the platform will support a better mechanism for syncing these "sessions" across multiple computers and browsers. This will allow a user to restore their "session" with the system if they loose their cookie or move to a different computer or browser.

In the mean time, because heaven knows when "The Future" will be upon us, you can save information in the entity variable AND back it up to a place like StringBin . Then in your app, when you check for saved data in the entity variable and there isn't any, you can also check StringBin to see if the user's data has been backed up there. If it has then you can "restore" the data and the user continues using the app never knowing any better of the awesomeness that you just did.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM