-
Notifications
You must be signed in to change notification settings - Fork 0
[CLEAN] Synthetic Benchmark PR #5748 - ConsolidatedView.Cache - first pass
#95
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?
Conversation
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: Clean (correct implementation)
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
Add caching layer for consolidated views with efficient site ID lookups
Refactor
site_ids/1to accept both Team and consolidated view IDImplement cache refresh strategies for all and recently updated views
Integrate ConsolidatedView.Cache into application supervision tree
Diagram Walkthrough
File Walkthrough
consolidated_view.ex
Refactor site_ids to support view ID lookupextra/lib/plausible/consolidated_view.ex
site_ids/1to accept bothTeam.t()andString.t()(consolidated view ID)
{:ok, [pos_integer()]} | {:error,:not_found}get/1query to includeinner_joinandpreloadteam associationcvtoconsolidated_viewfor claritycache.ex
New cache layer for consolidated viewsextra/lib/plausible/consolidated_view/cache.ex
Plausible.Cachebehaviorbase_db_query/0aggregating site IDs per consolidated viewrefresh_updated_recently/1for incremental cache updatesget_from_source/1andunwrap_cache_keys/1callbackscache.ex
Make refresh_updated_recently overridablelib/plausible/cache.ex
refresh_updated_recently/1function definition fromimplementation
defoverridable refresh_updated_recently: 1to allow moduleoverrides
behavior
application.ex
Integrate ConsolidatedView.Cache into supervisionlib/plausible/application.ex
ConsolidatedView.Cacheto supervision tree with EE guardrefresh_all(20 min interval) andrefresh_updated_recently(1 min interval)cache_test.exs
Add comprehensive cache teststest/plausible/consolidated_view/cache_test.exs
refresh_allstores correct site IDs per consolidated viewget_from_source/1returns same results as cachedata_case.ex
Enable EE macros in test supporttest/support/data_case.ex
use Plausibleto the quote block in DataCase templateon_eemacro