Hello,
I would like to be able to write to the cache of a dp without writting to the DB.
I.e: I have some static values on the DB and I want to query them a lot of times. It'd be nice to be able to fill the cache with current state of the dps without rewritting the values on the DB.
I think now it's not possible as dpSetCache always does a dpSet.
¿Am I missing something?
Thanks
Regards,
Pau
dpGetCache dpSetCache improvement
Search
-
- Posts: 6
- Joined: Tue Jan 28, 2020 1:01 pm
Re: dpGetCache dpSetCache improvement
Hello again,
I found the issue.
dpGetCache is also saving the value of the dp (dpGet) into the cache if the dp is not already in it. This means that dpSetCache is not required.
In order to do what I wanted is required to first do a dpRemoveCache(dp) and then a dpGetCache(dp). This will init the cache with current value of the dp.
Afterwards, dpGetCache will return the values without doing a dpGet.
Regards,
Pau
I found the issue.
dpGetCache is also saving the value of the dp (dpGet) into the cache if the dp is not already in it. This means that dpSetCache is not required.
In order to do what I wanted is required to first do a dpRemoveCache(dp) and then a dpGetCache(dp). This will init the cache with current value of the dp.
Afterwards, dpGetCache will return the values without doing a dpGet.
Regards,
Pau
Re: dpGetCache dpSetCache improvement
If you want to use dpGetCache() and dpSetCache() you have to be very careful. The cache only works for a single manager. If another manager is using the same data you will possibly get different results.
When you just want to store information in memory you can also use global variables. This might be easier then using the "cache" functions.
Best Regards
Leopold Knipp
Senior Support Specialist
When you just want to store information in memory you can also use global variables. This might be easier then using the "cache" functions.
Best Regards
Leopold Knipp
Senior Support Specialist