Parent

Methods

Class/Module Index [+]

Quicksearch

IncludedInMemcached

A specialized class using memcached to track items stored. It supports three operations: new, <<, and include? . Together these can be used to add items to the memcache, then determine whether the item has been added.

To use it with Spider use the check_already_seen_with method:

Spider.start_at('http://example.com/') do |s|
  s.check_already_seen_with IncludedInMemcached.new('localhost:11211')
end

Public Class Methods

new(*a) click to toggle source

Construct a new IncludedInMemcached instance. All arguments here are passed to MemCache (part of the memcache-client gem).

# File lib/spider/included_in_memcached.rb, line 40
def initialize(*a)
  @c = MemCache.new(*a)
end

Public Instance Methods

<<(v) click to toggle source

Add an item to the memcache.

# File lib/spider/included_in_memcached.rb, line 45
def <<(v)
  @c.add(v.to_s, v)
end
include?(v) click to toggle source

True if the item is in the memcache.

# File lib/spider/included_in_memcached.rb, line 50
def include?(v)
  @c.get(v.to_s) == v
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.