- if ($offset + $limit > self::CACHE_WINDOW) {
- return new ArrayWrapper(self::realBySubscribed($subscribedId,
- $offset,
- $limit));
- } else {
- $key = 'subscription:by-subscribed:'.$subscribedId;
- $window = self::cacheGet($key);
- if ($window === false) {
- $window = self::realBySubscribed($subscribedId,
- 0,
- self::CACHE_WINDOW);
- self::cacheSet($key, $window);
- }
- return new ArrayWrapper(array_slice($window,
- $offset,
- $limit));
- }
+ // "by subscribed" means it is the list of subscribers we want
+ $ids = self::getSubscriberIDs($profile_id, $offset, $limit);
+ return Subscription::listFind('subscriber', $ids);
+ }
+
+
+ // The following are helper functions to the subscription lists,
+ // notably the public ones get used in places such as Profile
+ public static function getSubscribedIDs($profile_id, $offset, $limit) {
+ return self::getSubscriptionIDs('subscribed', $profile_id, $offset, $limit);
+ }
+
+ public static function getSubscriberIDs($profile_id, $offset, $limit) {
+ return self::getSubscriptionIDs('subscriber', $profile_id, $offset, $limit);