Using ArcGIS Online user interface, it is possible to set / update Cache Control longest time. Default is 30 seconds, longest is 1 hour.
This can be done under Cache Control in Settings tab for Feature Layer (hosted) and Table (hosted) with Source: Feature Service.
I am publishing tables and feature layers programmatically using ArcGIS API for Python. I can't find a way to set the Cache Control value when publishing or update it later.
I did find it as property which I can access, but not update. Simplified example of code variations I have tried:
items = user.items()
item = items[0]
table = item.tables[0]
print(table.properties.cacheMaxAge)
cache_definition = {"cacheMaxAge": 600}
result = table.manager.update_definition(cache_definition)
# result = table.manager.add_to_definition(cache_definition)
print(result)
Printing cacheMaxAge does print out the actual value set / updated via interface (in seconds, e.g. 3600 for 1 hour). Result value is "{'success': True}". But the cacheMaxAge value does not update.
How can I set and/or update Cache Control (cacheMaxAge) using ArcGIS API for Python?