]>
cat aescling's git repositories - mastodon.git/blob - app/models/feed.rb
1 # frozen_string_literal: true
6 def initialize(type
, id
)
11 def get(limit
, max_id
= nil, since_id
= nil, min_id
= nil)
13 max_id
= max_id
.to_i
if max_id
.present
?
14 since_id
= since_id
.to_i
if since_id
.present
?
15 min_id
= min_id
.to_i
if min_id
.present
?
17 from_redis(limit
, max_id
, since_id
, min_id
)
22 def from_redis(limit
, max_id
, since_id
, min_id
)
23 max_id
= '+inf
' if max_id.blank?
25 since_id = '-inf
' if since_id.blank?
26 unhydrated = redis.zrevrangebyscore(key, "(#{max_id}", "(#{since_id}", limit: [0, limit], with_scores: true).map(&:first).map(&:to_i)
28 unhydrated = redis.zrangebyscore(key, "(#{min_id}", "(#{max_id}", limit: [0, limit], with_scores: true).map(&:first).map(&:to_i)
31 Status.where(id: unhydrated).cache_ids
35 FeedManager.instance.key(@type, @id)
This page took 0.160255 seconds and 6 git commands to generate.