Quantcast
Channel: Mendix Forum Questions
Viewing all articles
Browse latest Browse all 83469

Global variable or non-persistent entity to trigger db retreive

$
0
0

Hello,

Is it possible to create a global variable or non-persistent entity?

---- EDITED  ----- 

This is the use case in short:

I have a page that shows an object of entity A. The underlying object or rather associated objects can be updated at any time by all user. I'm estimating <100 concurrent users. When the the object is updated the page needs to update asap (<5s). Sometimes theses updates will come very frequently  and sometimes not for hours. Frequent = several times per minute.

Current solution: 

I have connected a persistent ChangedHelper, CH,  entity that has a 1-1 with entity A that only contains the changedDate of entity A. When A is changed, CH is also changed. Then I have a non-persistent entity, Entity NP-A that replicates the data from Entity A. A micro flow timer triggers a micro flow which compares the changed date of the ChangedHelper with the updatedDate of NP-A. If a refresh is needed A is retrieved from the db and NP-A is refreshed with the new data.

By using the ChagedHelper I reduced the number of  retrieves by approx 20%. 

Potential issue:

With this solution the client still has to do a db query every 5s wich means that the number of calls grows quickly with the number of users. If the MT that check if entity A has been updated instead could compare with a non-persistent entity/global variable it would save  a lot of DB calls.

Hope this clarifies my questions:

Thanks

:) Fredrik


Viewing all articles
Browse latest Browse all 83469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>