Saturday, July 7, 2018

Single-Record Caching

Microsoft Dynamics AX offers record caching. Rows selected through a cachekey are cached and successive look-ups specifying the cache-key are then served
from the record cache. The record-cache holds the rows that match frequently
issued single
-row queries.
The cache
-key is the Primary Key on the cached table. If a Primary Key does not
exist, the first unique index is used.


Because only single-row queries go into the cache, the cache is small with a
default value of 100 rows on the client and 2000 rows on the AOS.
Four single record cache settings are used with tables:
CacheLookup Result
None No data is cached or retrieved from cache for this table.
No caching should be used for tables that are heavily
updated or where it is unacceptable to read outdated
data.
NotInTTS All successful caching key selects are cached.
When in TTS (after ttsbegin), the record is read once
from the database and subsequently from cache. The
record is select-locked when read in TTS which ensures
that the record cached is not updated as long as the TTS
is active.
A typical example of its use is the CustTable in the
standard application. It is acceptable to read outdated
data from cache outside TTS, but when data is used for
validation or creating references it is ensured that it is
real-time data.
Found All successful caching key selects are cached. All
caching key selects are returned from cache if the record
exists there. A
select forupdate in TTS forces reading
from the database and replaces the record in the cache.
This is typically used for static tables like ZipCodes
where the normal case is that the record exists.
FoundAndEmpty All selects on caching keys are cached, even selects not
returning data.
All caching key selects are returned from caching if the
record exists there or the record is marked as non
existing in the cache.
An example of this kind of caching is found in the
InventTxt table in the standard application. For this
table it is a normal case that no record exists. Therefore,
in this case it is of great value to register the non
existing keys.

Important features about single-record caching are as follows:

The caching only works when selecting exactly one record, with a
distinct
where on the primary key.

The cache will not support fetch of multiple records in a query or a
"while select".


The cache does not support data retrieved by joining more than one
table.

 
The cache on the client is not updated with changes done from other clients. This
means that one client can cache and use invalid information.
The single record caching is selected by the CacheLookup property setting on the
table.
You can use the AOT find tool to list some examples of this setting.


Best Regards,
Hossein Karimi

No comments:

Post a Comment

Configure the Firewall on the Enterprise Portal Server

After you install Enterprise Portal, enable Web Server (HTTP) in Windows Firewall. If you do not enable the web server in Windows Firewall...