diff --git a/Project.toml b/Project.toml index 008ef2b..a00577b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Redis" uuid = "0cf705f9-a9e2-50d1-a699-2b372a39b750" -version = "3.0.0" +version = "3.0.1" [deps] DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" diff --git a/src/Redis.jl b/src/Redis.jl index 9ea9529..b294d18 100644 --- a/src/Redis.jl +++ b/src/Redis.jl @@ -35,7 +35,7 @@ export sadd, scard, sdiff, sdiffstore, sinter, sinterstore, export zadd, zcard, zcount, zincrby, zinterstore, zlexcount, zrange, zrangebylex, zrangebyscore, zrank, zrem, zremrangebylex, zremrangebyrank, zremrangebyscore, zrevrange, - zrevrangebyscore, zrevrank, zscore, zunionstore, zscan, + zrevrangebyscore, zrevrank, zscore, zunionstore, zscan, bzpopmin, Aggregate # HyperLogLog commands export pfadd, pfcount, pfmerge diff --git a/src/commands.jl b/src/commands.jl index d0c6100..b38edfb 100644 --- a/src/commands.jl +++ b/src/commands.jl @@ -164,6 +164,8 @@ resorting to the use of `Dict`, which cannot be used in the case where all entri # number), represented as string. @redisfunction "zscore" Union{AbstractString, Nothing} key member @redisfunction "zscan" Set{AbstractString} key cursor::Integer options... +# bzpopmin returns [key, data, score] or nothing if timeout is reached +@redisfunction "bzpopmin" Union{Array{AbstractString, 1}, Nothing} keys timeout function _build_store_internal(destination, numkeys, keys, weights, aggregate, command) length(keys) > 0 || throw(ClientException("Must supply at least one key")) diff --git a/test/redis_tests.jl b/test/redis_tests.jl index 0d99fe5..826c14d 100644 --- a/test/redis_tests.jl +++ b/test/redis_tests.jl @@ -325,6 +325,16 @@ function redis_tests(conn = RedisConnection()) vals2 = ["a", "b", "c", "d"] @test zinterstore(conn, testkey3, 2, [testkey, testkey2]) == 4 del(conn, testkey, testkey2, testkey3) + + # test using bzpopmin + vals2 = ["a", "b", "c", "d"] + zadd(conn, testkey, zip([4, 2, 1, 3], vals2)...) + @test bzpopmin(conn, testkey, 0) == [testkey, "c", "1"] + @test bzpopmin(conn, testkey, 0) == [testkey, "b", "2"] + @test bzpopmin(conn, testkey, 0) == [testkey, "d", "3"] + @test bzpopmin(conn, testkey, 0) == [testkey, "a", "4"] + @test bzpopmin(conn, testkey, 0.1) == nothing + del(conn, testkey) end @testset "Scan" begin