cancel
Showing results for 
Search instead for 
Did you mean: 

Clear OData metadata cache?

htammen
Active Contributor
0 Kudos

Is there an official way to clear OData metadata cache in a CAP application?

In my eventhandler I'm using:
req._.odataReq._service._getMetadataCache()._cachedMetadata.clear()

but that seems to be not the suggested way.

Regards
Helmut

gregorw
Active Contributor
0 Kudos

Hi Helmut,

what would be the exact use-case? During development you would just restart the CAP app or?

CU
Gregor

htammen
Active Contributor
0 Kudos

Hi Gregor,

I wrote an app in a multitenant environment with which the tenant can extend the CAP application dynamically via the app, not via cli.

After the extension has been applied the metadata cache has to be cleared to show the new metadata which includes the extension fields, entitties, ...

Regards Helmut

htammen
Active Contributor
0 Kudos

and gregorwolf besides that I need it after doing a Base Model Upgrade for one or more tenants.

When you deploy a new version of your SaaS app to the provider subaccount the changes are not automatically deployed to your tenants. You have to upgrade the Base Model in your tenants. But after such an upgrade the OData metadata does not reflect the new model cause the metadata is loaded from cache and hence is old.

gregorw
Active Contributor

I think it makes sense to link to your other question on this topic: Multitenancy Extend needs restart of app

Accepted Solutions (1)

Accepted Solutions (1)

htammen
Active Contributor
0 Kudos

The issue I had with refreshing metadata after applying an multitenancy extension was fixed with CAP cds 5.9.8.

s. also Multitenancy Extend needs restart of app

Answers (0)