You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My understanding... there may be cases I haven't considered.
In my testing, with simple_get_filter not implemented, removing the
names.nil? checks stopped get(context) being called again for every resource
which had pending changes. All resources of the given type were
collected from the system with one get() call and cached. Subsequent
calls to rsapi_provider_get returned the cached information.
When simple_get_filter is not implemented:
1. The cached data is returned, if the cache has been marked as complete and names is nil.
2. Therefore, if names is NOT nil or if the cache hasn't been marked complete, information about all resources of the given type is fetched by calling the provider's get() function.
3. The fetched information for all relevant resources is added to the cache.
4. The cache is marked complete if names is nil and simple_get_feature is not implemented.
5. Subsequent calls to rsapi_provider_get (e.g. to retrieve the current state of a resource which has pending changes) pass in a value for 'names', and therefore names.nil? is false, and the cache in point 1 above isn't returned or used. get() is therefore called again per resource to retrieve all resource information again.
Removing the names.nil? checks on lines 255 and 268 allows the cache to be populated with information about all of the resources of the given type with one get() call, mark the cache as complete, and therefore allow the cache to be used in subsequent calls to rsapi_provider_get for each resource.
Simple_get_filter behaviour wouldn't change, as when simple_get_filter is implemented the cache would never be marked as complete or returned: my_provider.get(context, names) would still be called every time.
0 commit comments