AnsweredAssumed Answered

PI Web API Ignoring "Cache-Control" Headers?

Question asked by zburke on Mar 14, 2019
Latest reply on Mar 26, 2019 by schristian

Hi Everyone!


Does anybody know if there are circumstances in which PI Web API will ignore "Cache-Control" headers? I'm attempting to make calls to PI Web API from PowerShell in a way that doesn't keep hitting the cache. (The eventual goal is to be able to benchmark how long each of these requests would take.) The script below should reflect what I'm trying to do:


$cred = Get-Credential

$time = Measure-Command {
    $result = Invoke-WebRequest `
        -Uri "https://localhost/piwebapi/attributes/F1AbEmIJUSg0YH0OFiTwOoMmSBQvbDzVUqE6BGpRgANOl3A5AYegZKq0ulUK0udsrMWtEagQ0VOVFJBTFBJU0VSVkVSXENPTkZJR1VSQVRJT05cT1NJU09GVFxQSSBDT1JFU0lHSFR8Q09SRVNJR0hUIFVSTA" `
        -Headers @{
        } `
        -Credential $cred



However, watching PI Web API's cache (from https://localhost/piwebapi/system/cacheinstances), every time I make this request I seem to have created / updated a cache instance. Indeed, starting from a point where I have no cache instances under my name, if I make this request multiple times the response returns blazingly fast every time after the first. So I'm pretty confident that this request is making full use of PI Web API's caching mechanism, even though that's exactly what I'm trying to avoid.


Does anybody know of any reason why the "Cache-Control" header wouldn't enable a simple request like this to avoid PI Web API's cache? Maybe there's a configuration item somewhere I'm missing, or my approach is generally misguided? I'm using Kerberos delegation and have a self-signed SSL certificate. I'm running PI Web API 2018.