Search code examples
delphisocketsindy3-tier

How to use the cache functions of KbmMW?


I have set the kbmMWUNIDACConnectionPool properties as this on the Server-side:

kbmMWUNIDACConnectionPool1.EnableCache := True;
kbmMWUNIDACConnectionPool1.MaxCacheAge := 30;
kbmMWUNIDACConnectionPool1.MaxCacheEntries := 100;
kbmMWUNIDACConnectionPool1.MaxCacheRecordCount := 10000;

But,I find the cache functions is not effectively,Please look the Unidac Monitor screenshot:

enter image description here

It's the same query statement,but the server-side ask the database everytime!Why? In a word: How to use the cache functions correctly ? Thanks in advance! :)


Solution

  • You need to enable that the query statement should be cached (Cached property of the xxxquery component) and how it should be cached, (CacheFlags on the same component).

    CacheFlags can be

    • mwcfDontAge - The cache entry do not expire and will stay in cache
    • mwcfDontGarbageCollect - The cache entry will never be garbage collected (effect is similar to dont age)
    • mwcfDefsOnly - Only definition for query (fielddefs and parameter definitions) will be cached.
    • mwcfUpdateOnResolve - If resolved, cache entry will be updated with new data and field/paramdefs.
    • mwcfLeaveOnResolve - If resolved, cache entry will be deleted.
    • mwcfNoParamsInCacheID - Dont store parameter contents as part of the cache ID (hence different parametervalues result in the same cache entry)
    • mwcfIgnoreCachedParams - No in use.