about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-12-03 17:02:09 -0600
committermultiple creatures <dev@multiple-creature.party>2019-12-03 17:06:47 -0600
commitbcb45d2cbe7abd2095c5e7657f2b62db1211fd9f (patch)
tree37af2a6a56623ee0bc400ed1bb2bc0c72bf4393e /app
parente63192cbb10eb2aabb13b919adecbea5d1317693 (diff)
add `all` & `all_cached` props to feed model
Diffstat (limited to 'app')
-rw-r--r--app/models/feed.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/feed.rb b/app/models/feed.rb
index 3e34be172..cf17ec25c 100644
--- a/app/models/feed.rb
+++ b/app/models/feed.rb
@@ -16,6 +16,15 @@ class Feed
     redis.zcount(key, '-inf', '+inf') || 0
   end
 
+  def all
+    unhydrated = redis.zrange(key, 0, -1, with_scores: true).map(&:first).map(&:to_i)
+    Status.where(id: unhydrated)
+  end
+
+  def all_cached
+    all.cache_ids
+  end
+
   protected
 
   def from_redis(limit, max_id, since_id, min_id)