Comment 2 for bug 1848550

Revision history for this message
Jeff Davis (jdavis-sitka) wrote :

Working branch user/jeffdavis/lp1848550-cache-settings leverages the offline settings cache to reduce org setting lookups in AngularJS:

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/jeffdavis/lp1848550-cache-settings

A "cachedate" column is added to the Setting table in IndexedDB. This tells us how long ago a setting was last looked up from the server. If the cachedate is more than 12 hours old, the cached value is ignored and the current value is retrieved from the server instead, which triggers an update of the offline cache value. (For offline, since we can't refresh from the server, we ignore the cachedate and use whatever value we've got.)

This approach means that org setting values could be up to 12 hours out-of-date in the client. I think that's a reasonable tradeoff since org settings rarely change, and at worst you can just clear local data to force a refresh. Alternatively, we could use a smaller interval, make it configurable, or add a server-side mechanism to force a cache refresh.

Most setting-related open-ils.actor traffic appears to be coming from AngularJS, but it would make sense to do the same thing in Angular once we've agreed on an approach.