-
Notifications
You must be signed in to change notification settings - Fork 0
[CORRUPTED] Synthetic Benchmark PR #5748 - ConsolidatedView.Cache - first pass
#96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: base_pr_5748_20251204_6260
Are you sure you want to change the base?
[CORRUPTED] Synthetic Benchmark PR #5748 - ConsolidatedView.Cache - first pass
#96
Conversation
Courtesy by @zoldar Co-authored-by: Adrian Gruntkowski <[email protected]>
…g?)" This reverts commit 03d18bc.
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||||
User description
Benchmark PR plausible#5748
Type: Corrupted (contains bugs)
Original PR Title:
ConsolidatedView.Cache- first passOriginal PR Description: ### Changes
This lets us have an interface to lookup regular site ids per consolidated view id efficiently. I don't think it needs more tests coverage at this point - since all the caches and their common characteristics are thoroughly tested elsewhere.
Tests
Changelog
Documentation
Dark mode
Original PR URL: plausible#5748
PR Type
Enhancement
Description
Introduce
ConsolidatedView.Cachefor efficient site ID lookupsAdd caching layer with refresh strategies for consolidated views
Refactor
site_ids/1to accept both Team and string identifiersUpdate
get/1to preload team association for consolidated viewsMake
refresh_updated_recently/1overridable in base Cache moduleAdd comprehensive test coverage for cache functionality
Diagram Walkthrough
File Walkthrough
consolidated_view.ex
Refactor site_ids and get functionsextra/lib/plausible/consolidated_view.ex
site_ids/1to accept both Team and string identifiers withconsistent return type
{:ok, [pos_integer()]} | {:error, :not_found}site_ids/1that delegates Team calls tostring-based implementation
get/1query to includeinner_joinwith team andpreload:[:team]cv→consolidated_view)cache.ex
Implement ConsolidatedView caching layerextra/lib/plausible/consolidated_view/cache.ex
Plausible.Cachebehavior forconsolidated views
base_db_query/0usingarray_aggto group site IDs byconsolidated view
refresh_updated_recently/1for incremental cache updatesbased on 15-minute window
get_from_source/1to fetch data from database when cachemiss occurs
unwrap_cache_keys/1to transform database rows into cachekey-value pairs
cache.ex
Make refresh_updated_recently overridablelib/plausible/cache.ex
refresh_updated_recently/1function head from implementation forclarity
delete_stale_items?: falseparameter, allowingimplementations to override
defoverridable refresh_updated_recently: 1to enable childmodules to customize behavior
application.ex
Register ConsolidatedView.Cache in applicationlib/plausible/application.ex
ConsolidatedView.Cacheto supervision tree underon_eeconditionrefresh_all(20-minute interval) andrefresh_updated_recently(1-minute interval)cache_test.exs
Add ConsolidatedView.Cache test suitetest/plausible/consolidated_view/cache_test.exs
refresh_allcorrectly stores site IDs grouped byconsolidated view
refresh_updated_recentlyadds new sites andre-consolidates views
get_from_source/1retrieves data from database correctlydata_case.ex
Add Plausible module to DataCasetest/support/data_case.ex
use Plausibleto the DataCase template for test support