Jump to content

Clear all cache?


David Edelman
Go to solution Solved by Patrick,

Recommended Posts

We are iteratively building PI AF structures and PI Analysis calculations over several hundred signals. When we backfill the calculations for the year, we have to "Clear Cache" on each signal individually to see the updated results.

Is there a way to clear all cache, either per user, per workbook or across the entire environment?

We are on R61.1.9-v202310161755, SaaS version, reading from OSISoft PI and OSISoft PI AF

Thanks, David

Link to comment
Share on other sites

  • Seeq Team

Hi David - While I'm not aware of an "easy button" to clear the cache on all items in a Workbench/Environment, you can programmatically clear the cache using the items API endpoint. 

One way to do this in Seeq Data Lab, given a list of signal IDs, is loop through that list and call the API endpoint to clear the cache with something like this:

signal_id_list=spy.search({'Path':'Path_to_AF_signals_that_need_to_be_cleared'},limit=max_number_of_expected_signals)['ID'].tolist()

items_api = sdk.ItemsApi(spy.client)

for signal_id in signal_id_list():
	items_api.clear_cache(id=signal_id,clear_dependents=True)

The above example will get all the signal IDs in the AF path of choice, then clear their cache and any dependent items that are used in Workbenches in your system. If you want to be more surgical, you could pull the item IDs from the Workbench (e.g., via spy.utils.get_analysis_worksheet_from_url(worksheet_url).display_items), but note you will want to get to the root of any calculations to make sure the cache clearing propagates through all dependencies.

 

Would this work for your use case?

Link to comment
Share on other sites

  • Seeq Team
  • Solution

One suggestion from my colleague that you can try as well if you want Datasource caching on, is go to the Admin page for the datasource and enable/disable/enable the cache (or, if it is already enabled, disable and re-enable the cache.)

This may achieve the same result without resorting to code.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...