self::FALLOFF_LIMIT) { Redis::zpopmin(self::CACHE_KEY . $pid); } return Redis::zadd(self::CACHE_KEY . $pid, $sid, $sid); } public static function delete($pid, $sid) { return Redis::zrem(self::CACHE_KEY . $pid, $sid); } public static function coldFetch($pid) { Redis::del(self::CACHE_KEY . $pid); $ids = DB::table('statuses') ->select('id', 'profile_id', 'type', 'scope') ->whereIn('type', ['photo', 'photo:album', 'video']) ->whereIn('scope', ['public', 'unlisted']) ->whereProfileId($pid) ->orderByDesc('id') ->limit(self::FALLOFF_LIMIT) ->pluck('id') ->toArray(); if($ids && count($ids)) { foreach($ids as $id) { self::add($pid, $id); } } Redis::zadd(self::COLD_CHECK_KEY, $pid, $pid); return $ids; } }