天天看點

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.

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

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裡讀出來的。

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

關于 SAP Spartacus 幫助文章上的 cache 設定

為所有站點資産以及可以緩存的 HTTP 請求(例如不經常更改的匿名使用者的 OCC 調用)維護二級 (L2) 緩存。這裡的配置不是指 Spartacus 實作代碼裡的配置

確定您對頁面的所有資産都有适當的浏覽器緩存政策。 當正确設定和調整時,浏覽器緩存可以節省大量帶寬并縮短頁面加載時間(初始和後續)。