天天看点

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 实现代码里的配置

确保您对页面的所有资产都有适当的浏览器缓存策略。 当正确设置和调整时,浏览器缓存可以节省大量带宽并缩短页面加载时间(初始和后续)。