From bcb45d2cbe7abd2095c5e7657f2b62db1211fd9f Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Tue, 3 Dec 2019 17:02:09 -0600 Subject: add `all` & `all_cached` props to feed model --- app/models/feed.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'app/models') 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) -- cgit