cancel
Showing results for 
Search instead for 
Did you mean: 

Gateway OData Metadata Cache

MarcoFreischlag
Advisor
Advisor
0 Kudos

Hello,

we're just about planning for our new OData Service. As we have a scenario where we generate structures to be used in our OData services we cannot make sure that the structures in the different clients are idetical as we will have additional customizing for this. In our use case that would mean that depending in which client the OData service is called the meta data could also be different. Entities and Entity Sets will be exactly the same as I use the same OData Service.

When I was testing the caching meachanism I got also confused with browser cache and the backend cache. Maybe you also made your experience and can provide me more details if I call the same service in different clients if we always access the same meta data...???

The informatio I got in SAP Help does not say anything regarding this:

Metadata Cache - SAP NetWeaver Gateway - SAP Library

Thanks & Regards Marco

Accepted Solutions (1)

Accepted Solutions (1)

former_member184867
Active Contributor

What I feel that you can not have different metadata for the same service in different client.

At runtime you can not change the metadata based on different clients. OData is a kind of extension on top of Atom Pub and Atom, with the additional feature of data description which is metadata in this case.

In Gateway Cache can be addressed/affected by ...

1. You can clear the cache in Gateway HUB using transaction /IWFND/CACHE_CLEANUP

2.You can clear the cache in Backend using transaction /IWBEP/CACHE_CLEANUP

3. You can deactivate caching from SPRO -->Gateway -->OData Channel -->Administration -->Cache Setting -> Metadata ..  Also you will find some more options for Cache here

4. Moreover Cache is one of the constraints of REST design which says something like

Cache constraints require that the data within a response to a request be implicitly or explicitly labeled as cacheable or non-cacheable. If a response is cacheable, then a client cache is given the right to reuse that response data for later, equivalent requests.

Now you can set no cache for the data (response) using following code in your DPC_EXT

*   Prevent persistent caching on client
DATA: ls_header TYPE ihttpnvp.

ls_header
-name  = 'Cache-Control' ##NO_TEXT.
ls_header
-value = 'no-cache, no-store' ##NO_TEXT.
set_header
( ls_header ).  //Or suitable method from DPC_EXT

ls_header
-name  = 'Pragma' ##NO_TEXT.
ls_header
-value = 'no-cache' ##NO_TEXT.
set_header
( ls_header ). //Or suitable method from DPC_EXT

Regards,

Atanu

Answers (2)

Answers (2)

MarcoFreischlag
Advisor
Advisor
0 Kudos

Just found that in table /IWBEP/I_MGW_CTC an entry for each odata service metadata is created which seems to be client specific. when I use TA /IWBEP/CACHE_CLEANUP to clear the cache only entries from the specific client were refreshed.

that means we have a separate cache for each client.

Regards Marco

kammaje_cis
Active Contributor
0 Kudos

Hi Marco,

Browser cache will not effect your runtime data. But if you are accessing the metadata in your client application, you may have to worry about it.

You have an option to disable the metadata cache. But this can significantly reduce the performance since the runtime needs to access the metadata frequently. May be you can give it a try.

The other option is to have an entity having properties which is a union of properties from all possible clients. This way you need not disable cache.

Thanks

Krishna