Sha256: 792660a3c3679653173947f8fb937b6cd8be02cc46ee6632f8babd4c3ce7eec7

Contents?: true

Size: 1.71 KB

Versions: 2

Compression:

Stored size: 1.71 KB

Contents

module Seymour
  module Store
    class Zset < Seymour::Store::Base

      def push(activity, score = activity.score)
        redis.zadd(key, score, activity.id)
      end

      def ids
        redis.zrevrange(key, 0, max_size).map(&:to_i)
      end

      def remove_id(id)
        redis.zrem(key, id)
      end

      def union_keys(keys, options = {})
        redis.zunionstore key, keys, options
      end

      def union(feeds, options = { :exclude_options => true })
        redis.zunionstore key, feeds.map(&:key), options
      end

      def intersect(feeds, options = {})
        redis.zinterstore key, feeds.map(&:key), options
      end

      # def zadd(score, member)
      #   redis.zadd(@key, score, member)
      # end

      # def zrange(range_start, range_end)
      #   typecast redis.zrange(@key, range_start, range_end)
      # end
      #
      # def zrem(member)
      #   redis.zrem(@key, member)
      # end
      #
      # def zincrby(increment, member)
      #   redis.zincrby(@key, increment, member)
      # end
      #
      # def zincr(member)
      #   zincrby(1, member)
      # end
      #
      # def zrevrange(range_start, range_end)
      #   typecast redis.zrevrange(@key, range_start, range_end)
      # end
      #
      # def zrangebyscore(min, max)
      #   typecast redis.zrangebyscore(@key, min, max)
      # end
      #
      # def zcard
      #   redis.zcard(@key)
      # end
      #
      # def zscore(member)
      #   redis.zscore(@key, member).to_f
      # end
      #
      # def zremrangebyscore(min, max)
      #   redis.zremrangebyscore(@key, min, max)
      # end
      #
      # def zremrangebyrank(start, _end)
      #   redis.zremrangebyrank(@key, start, _end)
      # end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
seymour-0.0.9 lib/seymour/store/zset.rb
seymour-0.0.8 lib/seymour/store/zset.rb