add `all` & `all_cached` props to feed model

master
multiple creatures 2019-12-03 17:02:09 -06:00
parent e63192cbb1
commit bcb45d2cbe
1 changed files with 9 additions and 0 deletions

View File

@ -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)