lobsters/lobsters

Refactor away Keystore for Rails.cache

Open

#1,585 opened on May 23, 2025

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Ruby (961 forks)user submission
featurereqgood first issueperformance

Repository metrics

Stars
 (4,680 stars)
PR merge metrics
 (Avg merge 7d 4h) (20 merged PRs in 30d)

Description

The Keystore model predates Rails.cache and Solid Cache. It's most commonly used as a read-through cache for aggregations. Some of these, like the count of a user's deleted stories, are easy to express in ActiveRecord queries, not expensive to calculate, and are buggy (#1084).

The most complicated use is comments.thread_id, which is effectively an autoincrement integer and only used in Comment.recent_threads. (User.recent_threads looks like dead code.) With AR having good support for RCTEs, this probably can be deleted. If not, let's replace with a TypeID.

#1548 is a blocker because several cron jobs depend on Keystore's durability, which Rails.cache doesn't guarantee.

Contributor guide