civis-python icon indicating copy to clipboard operation
civis-python copied to clipboard

Caching confusion in the client

Open keithing opened this issue 7 years ago • 5 comments

Heard of a use case recently where a user had a notebook instance open for a while and ran into an issue with caching. The user called APIClient(resources='all') but did not see new endpoints they expected to see (because they already called it earlier and the results were cached before the endpoints were created).

My impression is that it's not trivial to refresh lru_cache in smart way to avoid this and since this is a rare occurrence, we should address it with documentation.

keithing avatar Feb 20 '18 20:02 keithing

This doesn't seem like it should be that difficult to write code rather than docs for. Maybe we could a (spec, datetime) tuple and check the time.

fwiw, the CLI has code for invalidating old cached specs, but it depends on file metadata.

mheilman avatar Feb 20 '18 20:02 mheilman

Maybe this would work?

mheilman avatar Feb 20 '18 20:02 mheilman

oh, nice. cachetools looks interesting.

keithing avatar Feb 20 '18 21:02 keithing

To be clear, this is an instance where the Civis API changed mid-notebook session and the user wanted to access the new API endpoint(s) from an existing notebook, correct?

stephen-hoover avatar Jan 30 '19 19:01 stephen-hoover

To be clear, this is an instance where the Civis API changed mid-notebook session and the user wanted to access the new API endpoint(s) from an existing notebook, correct?

Yes, exactly.

keithing avatar Jan 30 '19 20:01 keithing