Jenna Poindexter · Oct 6, 2016

Invalidate DeepSee Result Cache for a Specific Cube


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?

0 275
Discussion (8)1
Log in or sign up to continue

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

write ##class(HoleFoods.Cube).%KillCache()

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?

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.

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

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?

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.

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?