Closed jhoerr closed 7 years ago
I think we have at least two options here:
Use Laravel's file cache to store query data. Upside: free. Downside: custom logic required to determine when to invalidate cache entries; high likelihood of stale data.
Use Laravel's Redis cache. Upside: No cache invalidation logic required; the Azure Functions can externally invalidate the cache entries whenever data is updated. Downside: nominal cost; maybe slower than file-based cache.
Some interesting thoughts on using Redis as a cache for JSON blobs. Conventional wisdom is to JSON stringify the entire set of query response data and store that as a single cache entry.
Caching/Invalidation plan of attack.
64ca3845bf1d169e743d2de939f86a63de95771d introduced caching data for bills and their related subject/committees. c141a585154948dfc6db33238a548b6ccb54a62a improved on that. These changes have dramatically improved responsiveness.
We now have a good mechanism for caching (via the web app) and invalidating the caches (via the functions) so I'll close this up.
There are several queries that appear to run relatively frequently, take a long time, and involve data that is infrequently updated. These would be excellent candidates for caching.
BillId
(~600ms). This data is updated every 10 minutes on weekdays between 8 AM and 8 PM.BillId
(~550ms). This data is updated once daily on weekdays at 7:30 AM.