26.08.2008, 17:05 | #1 |
Участник
|
axStart: Table caching in AX
Источник: http://axstart.spaces.live.com/Blog/...C0A0!371.entry
============== There is a lot of misunderstanding about caching of data in AX. Axapta 3.0 and 4.0 only caches data if you search exactly with the values of the primary index. I will show you with the next example. The primary index on the CustTable is on the field AccountNum. Example 1 will place the record in my cache. The second example will read from cache. Example 3 and 4 will not do it. static void cachingTest(Args _args) { CustTable custTable; CustTrans custTrans; //example 1* select custTable where custTable.AccountNum == "4001"; info(strfmt("%1",custTable.wasCached())); //not cached //example 2 select custTable where custTable.AccountNum == "4001"; info(strfmt("%1",custTable.wasCached())); //cached //example 3 select custTable where custTable.AccountNum == "4001" && custTable.Name == "The Glass Bulb"; info(strfmt("%1",custTable.wasCached())); //not cached //example 4 select custTable where custTable.AccountNum == "4001" join custTrans where custTable.AccountNum == custTrans.AccountNum; info(strfmt("%1",custTable.wasCached())); //not cached } * Incase the records was already cached on the AOS cache status is SvrRecordCached In AX 2009 the caching mechanism has improved. Any unique index will be used for caching optimizing. So let’s repeat the test in AX2009. In the next example (2009), we search 2 times for the same record. The first time we use index PartyID that places the record in the cache the second time we search by accounnum index and will find the result in the cache. static void cachingTest(Args _args) { CustTable custTable; CustTrans custTrans; //example 1* select custTable where custTable. PartyId== "215"; //PartyID is also has also an unique index info(strfmt("%1",custTable.wasCached())); //not cached //example 2 select custTable where custTable.AccountNum == "4001"; //same record like partyID == “215” info(strfmt("%1",custTable.wasCached())); //cached //example 3 select custTable where custTable.AccountNum == "4001" && custTable.Name == "The Glass Bulb"; info(strfmt("%1",custTable.wasCached())); //not cached //example 4 select custTable where custTable.AccountNum == "4001" join custTrans where custTable.AccountNum == custTrans.AccountNum; info(strfmt("%1",custTable.wasCached())); //not cached } * Incase the records was already cached on the AOS cache status is SvrRecordCached NOTE: Still there is a primary index property in the AOT, I don’t know why. Источник: http://axstart.spaces.live.com/Blog/...C0A0!371.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|