Module: Tekeya::Feed::Activity::Resque::ClassMethods

Defined in:
lib/tekeya/feed/activity/resque.rb

Instance Method Summary collapse

Instance Method Details

#write_to_feed(feed_key, score, activity_key) ⇒ Object

Writes the activity reference to the feed with the supplied key

Parameters:

  • feed_key (String)

    the key of the feed where the activity will be referenced

  • score (Integer)

    the score of the activity (timestamp) used to order the feed

  • activity_key (String)

    a string containing the key to reference the activity



17
18
19
20
21
22
23
# File 'lib/tekeya/feed/activity/resque.rb', line 17

def write_to_feed(feed_key, score, activity_key)
  # add the activity to the owner's profile feed
  ::Tekeya.redis.zadd(feed_key, score, activity_key)
  # increment the activity counter to keep track of its presence in feeds
  activity_counter_key = "#{activity_key}:counter"
  ::Tekeya.redis.incr(activity_counter_key)
end