still got Redis::Future result after exit pipeline block, why?(using redis-ruby)

646 views
Skip to first unread message

Sandy

unread,
Jul 12, 2012, 11:16:36 PM7/12/12
to redi...@googlegroups.com
Is the pipeline async, namely will redis-rb execute following codes without finishing pipeline first?

Pieter Noordhuis

unread,
Jul 12, 2012, 11:26:41 PM7/12/12
to redi...@googlegroups.com
You didn't include a code snippet.

Redis::Future objects will get their value after the pipeline block completes.

For instance:
```
redis.pipelined do
@value = redis.get "key"
# The pipeline has not yet been executed, so futures are not yet
populated with their values
end

# The pipeline has now been executed, and futures have their values
@value.get # => "some value"
```

Cheers,
Pieter

On Thu, Jul 12, 2012 at 8:16 PM, Sandy <sandy....@gmail.com> wrote:
> Is the pipeline async, namely will redis-rb execute following codes without
> finishing pipeline first?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/redis-db/-/g2s0XpgroYgJ.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to
> redis-db+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/redis-db?hl=en.

Sandy

unread,
Jul 13, 2012, 1:34:43 AM7/13/12
to redi...@googlegroups.com

Here is a code screenshot. The basic idea is to compute pagerank for each page. The original page rank and page outlinks are stored in redis. 

I try to get all rank and links for each page using a pipeline, but got Redis::Future(No method error)when accessing links.length



在 2012年7月13日星期五UTC+8上午11时26分41秒,Pieter Noordhuis写道:
You didn't include a code snippet.

Redis::Future objects will get their value after the pipeline block completes.

For instance:
```
redis.pipelined do
  @value = redis.get "key"
  # The pipeline has not yet been executed, so futures are not yet
populated with their values
end

# The pipeline has now been executed, and futures have their values
@value.get # => "some value"
```

Cheers,
Pieter

On Thu, Jul 12, 2012 at 8:16 PM, Sandy <sandy....@gmail.com> wrote:
> Is the pipeline async, namely will redis-rb execute following codes without
> finishing pipeline first?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/redis-db/-/g2s0XpgroYgJ.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to
> redis-db+unsubscribe@googlegroups.com.

Pieter Noordhuis

unread,
Jul 13, 2012, 11:55:20 AM7/13/12
to redi...@googlegroups.com
You have to call #get on the future to get its value. It doesn't transparently proxy it.

In the future please use something like http://gist.github.com/ for code samples.

Cheers,
Pieter

To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/RXcnplDyiecJ.

To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.

Sandy

unread,
Jul 13, 2012, 12:17:53 PM7/13/12
to redi...@googlegroups.com
Thanks for your advice.
As for the problem, I tried "links = linkshsh[page].get" but got:
  undefined method `get' for <Redis::Future [:hget, "15502875","currank"]>:Redis::Future
Did I got something wrong?

在 2012年7月13日星期五UTC+8下午11时55分20秒,Pieter Noordhuis写道:

Pieter Noordhuis

unread,
Jul 13, 2012, 12:53:08 PM7/13/12
to redi...@googlegroups.com
Sorry, it's #value.


Cheers,
Pieter

To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/YWR9jyrnAY4J.

To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.

Sandy

unread,
Jul 13, 2012, 1:03:08 PM7/13/12
to redi...@googlegroups.com
Thanks so much for your help.

在 2012年7月14日星期六UTC+8上午12时53分08秒,Pieter Noordhuis写道:

Bhanu Gandikota

unread,
Jul 13, 2012, 1:10:57 PM7/13/12
to redi...@googlegroups.com
Can someone please let me know if we have debian package available for Redis 2.6.0-rc1?

Thanks in advance!

Bhanu G
--
Bhanu M. Gandikota 
Rubicon DBA Team 

Reply all
Reply to author
Forward
0 new messages