Usually there are 3 kind of files involved in caching
- The static content like HTML, JavaScript, CSS, Images etc. It is the WebServer (IIS in this case) which decides what will be cache duration and is configurable.
- AgilePoint REST API Data: There are things like form definition, lookup def, library etc. which are not changing till new app is published so can be reliably cached in browser. When new version is pushed out, it gets new GUID so system intelligently decided what to download. Caching in REST API GET request is common thing as per REST spec but browser won’t automatically do it. Roy Fielding who defined REST originally had defined that in his dissertation. This is where onus is on application to set headers
- If it is a cross domain call like SharePoint making API call to AgilePoint where both are in different domain, by default browser sends a OPTIONS request to check if receiving server trusts the caller. However receiver can send header back to say next time don’t send OPTION request unless really necessary. Then browser caches it.
All the 3 things are 100% configurable and clients can pick cache duration. I actually set my local machine for cache to expire after 1 Year. Here is how it can be done
Static Content: This is done by IIS but you can put a line in web.config to instruct IIS to send cache duration. We have as per industry best practice set it to 7 days. This is what everyone over internet says is a good range. However they can increase it to any value. They just need to make change in 2 config file
C:\Program Files\AgilePoint\AgilePointWebApplication\AgilePointPortal\
Modules\AgilePoint.Portal.AppBuilder\Content\Web.config
C:\Program Files\AgilePoint\AgilePointWebApplication\AgilePointPortal\
Modules\AgilePoint.Portal.Core\Content\Web.config
You will see following line instructing webserver to cache it for 7 days. Change to 365
<staticContent>
<clientCache cacheControlMode=”UseMaxAge” cacheControlMaxAge=”7.00:00:00″ />
</staticContent>
Change to
<staticContent>
<clientCache cacheControlMode=”UseMaxAge” cacheControlMaxAge=”365.00:00:00″ />
</staticContent>
This is standard IIS setting
REST (GET Request) Caching: REST API data as explained above has smart caching algorithm so can be cached for longer durations. We have set it as default to 14 days as user might access it once in 14 days atleast. However it is configurable and user can change to any value he wants. Here is how it can be changed to 1 year which is 31536000 sec
C:\Program Files\AgilePoint\AgilePointWebApplication\AgilePointPortal\
Modules\AgilePoint.Portal.AppBuilder\Content\FD.Settings.xml
<Property Type=””>
<Name>CacheExpiryTime</Name>
<Value>31536000</Value>
</Property>
OPTIONS request caching: This is only thing which AgilePoint server has to specify as only receiver can decide this and not sender. We have even this configurable and cache is set for 14 days which should be more than enough for most people as they will access atleast once but if that is a concern, you can set it to higher value
C:\Program Files\AgilePoint\AgilePointServerInstance\bin\Ascentn.AgilePoint.WCFService.exe.config
<add key=”Cache_Control_max_age” value=”31536000″ />
So just changing those 4 config’s, I changed my caching to be 1 Yr. Client can decide what is reasonable for them. Here is a screenshot
See how my files are getting cached for 1 Yr or till I manually clear it.