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

Hybris Cachenode

(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.app

Hybris cache的目的是爲了減小對DB layer的訪問.spa

When Data Is Cached3d

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:code

(1) Caching item attributes:orm

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

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

(2) Caching FlexibleSeach results:ci

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

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的原創文章,請關注公衆號"汪子熙":

相關文章
相關標籤/搜索