AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX: База знаний и проекты
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 17.05.2007, 20:01   #1  
EVGL is offline
EVGL
Banned
Соотечественники
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
 
4,445 / 3001 (0) ++++++++++
Регистрация: 09.07.2002
Адрес: Parndorf, AT
Развивающая игра с xRecord.wasCached(), RecordViewCache
Многие опытные разработчики думают о кешировании записей и выполняют соответствующие действия "про запас", не имея времени проверить, работает ли кеш, или не зная, как это можно проверить.

Коллега нашел решение: метод xRecord.wasCached().

Предлагаю всем желающим самостоятельно протестировать и проанализировать следующий код (для 4.0, если это имеет значение):

X++:
static server void testCaching() // try to call on the client
{
    SalesLine       salesLine, salesLineRVC;
    RecordViewCache rvc;
    #DEFINE.TestInventTransId('08587_059')

    void showInfo(str _desc, SalesLine _salesLine)
    {
        ;
        setPrefix(_desc);
        info(strFmt("InventTransId = '%1', .wasCached() = '%2'.", _salesLine.InventTransId, _salesLine.wasCached()));
    }
    ;

    new Application().flushcompanycache(curExt());  // try to comment this out and start a couple of times
    Dictionary::dataFlush(salesLine.TableId);       // "-"
    info("All caches have been flushed");

    select firstonly salesLine
        where salesLine.InventTransId   == #TestInventTransId;
    showInfo("1. A select over an indexed field", salesLine);

    select firstonly salesLine
        where salesLine.InventTransId   == #TestInventTransId;
    showInfo("2. The same select", salesLine);

    ttsbegin;
    select firstonly salesLine
        where salesLine.InventTransId   == #TestInventTransId;
    showInfo("3. The same select as the 1 and 2, but in TTS", salesLine);
    ttsabort;

    select firstonly salesLine
        where salesLine.InventTransId   == #TestInventTransId   &&
              salesLine.ConfirmedDlv    <= systemDateGet();
    showInfo("4. A slightly different select over a non-index field", salesLine);

    select firstonly salesLine
        where salesLine.InventTransId   == #TestInventTransId   &&
              salesLine.ConfirmedDlv    <= systemDateGet();
    showInfo("5. The same as 4, called the 2nd time", salesLine);

    select firstonly nofetch salesLineRVC
        where salesLineRVC.InventTransId    == #TestInventTransId;
    rvc = new RecordViewCache(salesLineRVC);

    select firstonly salesLine
        where salesLine.InventTransId   == #TestInventTransId   &&
              salesLine.ConfirmedDlv    <= systemDateGet();
    showInfo("6. The same as 4 and 5, but after an RVC has been instantiated", salesLine);
}
Результат работы:
Цитата:
All caches have been flushed
1. A select over an indexed field InventTransId = '08587_059', .wasCached() = 'NotCached'.
2. The same select InventTransId = '08587_059', .wasCached() = 'RecordCached'.
3. The same select as the 1 and 2, but in TTS InventTransId = '08587_059', .wasCached() = 'NotCached'.
4. A slightly different select over a non-index field InventTransId = '08587_059', .wasCached() = 'NotCached'.
5. The same as 4, called the 2nd time InventTransId = '08587_059', .wasCached() = 'NotCached'.
6. The same as 4 and 5, but after an RVC has been instantiated InventTransId = '08587_059', .wasCached() = 'ViewCached'.

Последний раз редактировалось EVGL; 17.05.2007 в 20:04.
За это сообщение автора поблагодарили: glibs (2), kashperuk (18), Logger (2), Kabardian (2).
Теги
recordviewcache, тестирование

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Глюки RecordViewCache Logger DAX: Программирование 9 22.04.2008 14:12
! "по выбранному курсору нельзя инициализировать recordViewCache" netbas DAX: Программирование 9 20.12.2007 15:24
Заказ/Закупка - ошибка xRecord Mok DAX: Программирование 3 07.12.2005 12:15
Как заставить работать xRecord.suppressWarnings() Logger DAX: Программирование 13 29.08.2005 16:22
Игра для программистов Ruff DAX: База знаний и проекты 4 09.02.2004 08:27

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 01:02.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.