
Cache busting API
Now the cache is fully in your control - we have a new API to purge the cache. This means the cache can be tied to changes upstream - ETL cycles, dbt runs, or simply because you have new…
Transcript
This transcript is auto-generated. Names and product terms may be wrong.
and for some reason I can't find the button to start sharing so you know we all have our challenges let's see try this one there we go um okay I worked on something this week that uh sort of like had a steady trickle of requests you know from last year no major urgency but felt important to me so I was like well let's see if we can get this started so um what you see here is I've just got our basic model I've created uh a a plain old cash policy called Buster with a max cach age arbitrary number and uh and then I've set that as the default cash policy for my model um and then other things to note about my model is
just I've added this one uh Dimension to the users view called now which you can see is just SQL now uh I'm gonna go ahead and create a new analysis and I'm going to jump into the users View and I'm gonna uh add the field now we'll make this a chart so that you can actually see it and I'm also I'm going to go ahead and add um another query really exciting here we're going to select now and run that um you can see this actually ran from cash probably because it's got the same SQL as something else that I just ran um but the point is that it hit the cach and and if I run it again I hit the cash and uh
you know same thing over here run this again I hit the cash you can see the time didn't change so now I'm going to jump over to postman which is uh just a API client and I've added this new API that's my daughter having a bounce over there um we've got this new API called cach reset and I'm just going to hit this API uh I'm not going to include the the reset at so if I don't include this parameter here in the post body it will um it'll just set reset the cach uh expiration time to right now so I'm going to go ahead and send this API request uh you can see that uh I got a response back that I've reset the
uh that particular cash policy to be reset at this is right now and now if I jump back over here and I rerun this guy you can see that the time Chang and everybody's happy uh if I run it again of course now it hit the cash because I just ran it since the cash happened uh and then if you actually wanted to restore some old cached content uh you could actually um reset the cache at a previous time uh in the past and you can see that that updated that cash policy and uh now if I run again I actually haven't tested this but it should uh I doing this backwards oh yeah I would I would have expected that to to hit the
cash um but anyway you see uh where this is going uh we now have an API to reset the cash I still have plenty of tests to write hopefully we'll be able to get those done maybe next week while we're in Cabo uh but if not certainly the following week this will be in production and then uh building on top of this we should be able to layer in trigger checking so that it's not just API based but you can have a trigger to say hey has something changed in the database so I should reset the cash and then uh also tie in things like hey when this cash policy resets let's base some you know scheduled sends some some content sends on the cash
policy resetting so um uh this is kind of the the starting point of of getting our our cash policies to be a little bit more uh more powerful oh