Skip to content

Add caching for historical data#2476

Merged
benhalpern merged 2 commits intoforem:masterfrom
Zhao-Andy:feature/add-caching-to-api-analytics
Apr 18, 2019
Merged

Add caching for historical data#2476
benhalpern merged 2 commits intoforem:masterfrom
Zhao-Andy:feature/add-caching-to-api-analytics

Conversation

@Zhao-Andy
Copy link
Copy Markdown
Contributor

What type of PR is this? (check all applicable)

  • Feature

Description

This adds caching for any historical data for analytics. Since most of the data is static, we'll cache it for 7 days. Data for the current day will be cached for 30 minutes. This should help improve the query speed, but we'll want to explore using SQL GROUP or other methods detailed in #2311 for a longer term solution.

I wasn't sure what other tests to add, but I tested this in development and it was hitting the cache. A two week query only used two SQL queries and took 21ms to load.

@pr-triage pr-triage bot added the PR: unreviewed bot applied label for PR's with no review label Apr 17, 2019
@pr-triage pr-triage bot added PR: reviewed-approved bot applied label for PR's where reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Apr 18, 2019
@benhalpern benhalpern merged commit 9b1ef39 into forem:master Apr 18, 2019
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged and removed PR: reviewed-approved bot applied label for PR's where reviewer approves changes labels Apr 18, 2019
coreyja added a commit to coreyja/dev.to that referenced this pull request Apr 20, 2019
* master: (83 commits)
  Update gitdocs (forem#2500)
  Condense 'ask me anything' to 'ama' (forem#2428) [ci skip]
  Add user_signed_in? to cache key for styles (forem#2498)
  Added troubleshooting for byebug without readline issue (forem#2481)
  Fix some frontend linting issues (forem#2495) [ci skip]
  Fix <br/> in footer. (forem#2491)
  Remove extra param and add message for prefill (forem#2487)
  Make Cards Change Dynamically and add Reader/Follower Charts (forem#2488)
  Temporarily comment out random (forem#2486)
  Add nav buttons to pwa desktop (forem#2484)
  Feature/filtered charts (forem#2482)
  Add caching for historical data (forem#2476)
  There are installation sections for other OSes now. (forem#2480)
  Add inbox guidelines to users (forem#2473)
  Release Open Inbox (forem#2468)
  Convert underscores in article slugs properly (forem#2472)
  Update framework defaults to match those in Rails 5.1 (forem#2309)
  Enable random order for specs (forem#2466) [ci skip]
  forem#118 Allow users to embed Medium posts with Liquid Tags (forem#1161)
  Allow API to return top articles (forem#2469)
  ...

# Conflicts:
#	Envfile
#	app/models/user.rb
#	db/schema.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: merged bot applied label for PR's that are merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants