Sha256: 6add1ccae045ef85e64f3f914fb3e1b11a4978336f1c2c972e06cff4a4f352b8
Contents?: true
Size: 1 KB
Versions: 54
Compression:
Stored size: 1 KB
Contents
# encoding: UTF-8 require File.expand_path("./helper", File.dirname(__FILE__)) setup do init Redis.new(OPTIONS) end test "SORT" do |r| r.set("foo:1", "s1") r.set("foo:2", "s2") r.rpush("bar", "1") r.rpush("bar", "2") assert ["s1"] == r.sort("bar", :get => "foo:*", :limit => [0, 1]) assert ["s2"] == r.sort("bar", :get => "foo:*", :limit => [0, 1], :order => "desc alpha") end test "SORT with an array of GETs" do |r| r.set("foo:1:a", "s1a") r.set("foo:1:b", "s1b") r.set("foo:2:a", "s2a") r.set("foo:2:b", "s2b") r.rpush("bar", "1") r.rpush("bar", "2") assert ["s1a", "s1b"] == r.sort("bar", :get => ["foo:*:a", "foo:*:b"], :limit => [0, 1]) assert ["s2a", "s2b"] == r.sort("bar", :get => ["foo:*:a", "foo:*:b"], :limit => [0, 1], :order => "desc alpha") end test "SORT with STORE" do |r| r.set("foo:1", "s1") r.set("foo:2", "s2") r.rpush("bar", "1") r.rpush("bar", "2") r.sort("bar", :get => "foo:*", :store => "baz") assert ["s1", "s2"] == r.lrange("baz", 0, -1) end
Version data entries
54 entries across 54 versions & 7 rubygems