Question Jenna Makin · Oct 6, 2016

Invalidate DeepSee Result Cache for a Specific Cube

Hi-

I know that you can run the %Reset method within %DeepSee.Utils to reset all of the DeepSee tasks and reset the entire result cache.

Is there any way to invalidate the result cache for a single cube?

Comments

Eduard Lebedyuk · Oct 6, 2016

You can call %KillCache method in a cubeclass. It does exactly that. For example:

write ##class(HoleFoods.Cube).%KillCache()
0
Jenna Makin  Oct 6, 2016 to Eduard Lebedyuk

One concern with using this method is that it actually goes in and kills all of the cache for the cube by killing the globals containing the cache.  What affect will this have if it is done while users are using the Analyzer for example?

0
Eduard Lebedyuk  Oct 6, 2016 to Jenna Makin

Empty results or an error probably.

0
Jenna Makin  Oct 19, 2016 to Eduard Lebedyuk

As mentioned already, running ##class(HoleFoods.Cube).%KillCache() would actually go in and purge the internal globals associated with the result cache for that particular cube.  Not really the best thing to do on a production system.

A safer way to invalidate cache for a given cube would be to run %ProcessFact for an individual record within the source table for the cube.

For example

&sql(select top 1 id into :id from <sourcetable>)

do ##class(%DeepSee.Utils).%ProcessFact(<cubename>, id)

 

replacing <sourcetable> with the source table for your cube and <cubename> with the name of the cube.

This has the effect of causing the result cache for the cube to be invalidated without completely purging the internal globals that store the cache.  This is much safer to run during production times than the %KillCache() method.

0
Eduard Lebedyuk  Oct 19, 2016 to Jenna Makin

It would only invalidate one chunk (most probably first, but ultimately it depends on id) of cube data, not all of them.

0
Jenna Makin  Oct 19, 2016 to Eduard Lebedyuk

So if we were to use the APIs to update the dimension table directly for example, this would not be adequate to insure that future queries showed the proper data?

0
Eduard Lebedyuk  Oct 19, 2016 to Jenna Makin

It would, because cache for that chunk would be invalidated, and cache for other chunks would still be valid. But OP wants to invalidate cache for a whole cube, and for that inserting one fact is not enough.

0
Jenna Makin  Oct 19, 2016 to Eduard Lebedyuk

So this begs the question, how could one invalidate the result cache for the entire cube without running %KillCache as that purges the underlying globals and would interfere with actively running queries, correct?

0