in src/server/cache-manager.ts [129:160]
async update(
name: string,
updateParams: CachedContentUpdateParams,
): Promise<CachedContent> {
const url = new CachedContentUrl(
RpcTask.UPDATE,
this.apiKey,
this._requestOptions,
);
url.appendPath(parseCacheName(name));
const headers = getHeaders(url);
const formattedCachedContent: _CachedContentUpdateRequestFields = {
...updateParams.cachedContent,
};
if (updateParams.cachedContent.ttlSeconds) {
formattedCachedContent.ttl =
updateParams.cachedContent.ttlSeconds.toString() + "s";
delete (formattedCachedContent as CachedContentCreateParams).ttlSeconds;
}
if (updateParams.updateMask) {
url.appendParam(
"update_mask",
updateParams.updateMask.map((prop) => camelToSnake(prop)).join(","),
);
}
const response = await makeServerRequest(
url,
headers,
JSON.stringify(formattedCachedContent),
);
return response.json();
}