Skip to main content
16-Pearl
June 11, 2024
Question

What are the various idea to store temporary data/cache

  • June 11, 2024
  • 5 replies
  • 3397 views

I stored infotable data in userextensions which will be moved to datatable once user clicked submit button. 

But updating one infotable userextension property for frequent service execution causing loss of data. 

Any other possible ways are there to store infotable values temporarily?

5 replies

Rocko
19-Tanzanite
June 11, 2024
16-Pearl
June 11, 2024

It is working in expression of mashup. But how to execute this from Things>>Services ?

Rocko
19-Tanzanite
June 11, 2024

If you need this server side, you can think about transient properties (not persistent, not logged), and you could create your own UserSessionThing which holds those properties, tied to the User and their current session.

mstarnaud
16-Pearl
June 11, 2024

Hi AP

 

Have you considered using a DataTable entity?

 

In Composer, you can create a DataTable by associating in to a specific DataShape. In Composer it gives you a UI ("Mashup" tab) to view & modify the data without needing to create a custom Mashup. It also comes with pre-made services, like QueryDataTableEntries and AddDataTableEntry to view and modify the data, you could use those services in a custom Mashup.

 

If you need to separate them by user, you could their default "Source" column, or add a custom User column to the DataShape, or even create a separate entity for each user.

16-Pearl
June 11, 2024

Ofcourse it is user specific data. 
Will it work even if n number of users updating at same time?

mstarnaud
16-Pearl
June 11, 2024

As I said, you do have the possibility of creating a different entity for each user. For example TempDataTable_mstarnaud, TempDataTable_AP103343008, TempDataTable_Rocko. You could even manage their permissions so only the related user has access.

 

I'm not an expert on DataTables. But if you're using 1 DataTable shared to everyone, I do think you would have the risk that 2 people may try to modify the same record and one user's changes would override the other user's changes. For example if both users look at the same record, then user #1 deletes the record, and user #2 then tries to update it I'm expecting the update will fail. Which is why in your case using 1 shared DataTable and the default Composer UI may not be the best idea, I would suggest either separating it (1 DataTable per user) and/or making a Mashup that only gets the current user's records.

12-Amethyst
June 12, 2024

I'm not sure if I understand your question.
Do you have user A using his PC, user B using this same app at different PC? And you want store datas of user A to be storing his own data in such way, it does not influence user B, and vice-versa? So, if user A stores his data, THEN user B store his - it does not overwrite user A data?
Sounds like session info/session parameters. Here you have docu for it: Session Parameters (ptc.com).
But I'm just testing it so can not confirm if it works well. 

Community Moderator
June 17, 2024

Hello @AP_10343008

 

It looks like you have some responses from some community members. If any of these replies helped you solve your question please mark the appropriate reply as the Accepted Solution. 

Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Community Moderation Team.

19-Tanzanite
June 18, 2024

Hi @AP_10343008 ,

 

To obtain an effective answer you need to explain in detail the data you're keeping in that User Extension property.

I find it hard to believe that the data is overwritten for a single user just due to frequent service execution, meaning from what I understand, that the user clicked too fast the submit button.

 

16-Pearl
July 8, 2024

Yes. When I am using Infotable property created in user extension, The service updates each row of infotable continously. 
Example: If second row of infotable property updating before first row updation completes, then ill lose first row data. 

If third row started updating in infotable property before second row gets updated, then ill lose second row data.

19-Tanzanite
July 9, 2024

In this situation (storing the whole infotable) whatever data store you'd use, you would still have this issue.

You need to have a data store that allows you to update separate rows atomically, without affecting the other rows. Infotables are always updated in their entirety, there's no capability to update only a row.

I would suggest the following:

  1. Separate these rows as properties. If your infotable contains maximum let's say 10-20 rows, you can separate these as properties (still on the UserExtension side). You can, or not, make these persistent or not.
  2. Store these rows as items in a DataTable, SQL Table or Stream. I typically do not prefer this because updating these rows (that would also need to have an User column to be User-specific) effectively "hit" the disk, hence always generating I/O - no chance to disable this. If we're speaking about very frequent updates, which it's subjective, you need to be aware and measure the impact on the database.