博客 / 詳情

返回

SAP Hybris platform和Netweaver的緩存(Cache)設計機制

Hybris Cache

(1 )The Hybris Cache is a part of the Hybris persistence layer.
(2) It improves the performance of a single server node by reducing the amount of database queries.
(3) It transparently stores search results, item attributes, and item instances in memory.

Hybris cache的目的是為了減少對DB layer的訪問.

When Data Is Cached

The Hybris Cache works transparently. Every time the API is accessed, the cache intercepts calls and handles caching implicitly. The following examples present how caching works:

(1) Caching item attributes:

When calling product.getCode(), the underlying data is returned from the cache or, if not yet cached, retrieved and written to the cache.

When calling product.setCode(X), the cached value is removed (invalidated) from the cache, because it is no longer valid.

(2) Caching FlexibleSeach results:

When executing a FlexibleSearch query like SELECT code FROM Product, the result list is cached in the main cache.

When a product is removed, then its item data and the cached FlexibleSearch result for the above query is removed from the cache.

從這一點來説,Hybris platform cache和Netweaver table buffer做的作用一樣。在ABAP裏,application developer寫Open SQL時也從不用去care當前用SELECT讀進內表的數據到底是從buffer裏讀的,還是從DB裏讀出來的。


從buffer裏讀取效率比從DB裏高得多:

DATA: ls TYPE crmc_proc_type,
ls2 TYPE comm_product.
SELECT SINGLE * INTO ls FROM crmc_proc_type.
SELECT SINGLE * INTO ls2 FROM comm_product.
單位:微秒




ST02查看Netweaver的table buffer:


Hybris裏在admin console裏查看和管理cache:

要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":

user avatar
0 位用戶收藏了這個故事!

發佈 評論

Some HTML is okay.