Class: Rspider::UrlStorageInMemcache
- Inherits:
-
Object
- Object
- Rspider::UrlStorageInMemcache
- Defined in:
- lib/rspider/UrlStorage.rb
Instance Method Summary collapse
- #<<(u) ⇒ Object
-
#initialize ⇒ UrlStorageInMemcache
constructor
A new instance of UrlStorageInMemcache.
- #pop ⇒ Object
- #visited(u) ⇒ Object
- #visited?(u) ⇒ Boolean
Constructor Details
#initialize ⇒ UrlStorageInMemcache
Returns a new instance of UrlStorageInMemcache.
29 30 31 |
# File 'lib/rspider/UrlStorage.rb', line 29 def initialize() @cache=MemCache.new "localhost:11211",:namespace=>"hel" end |
Instance Method Details
#<<(u) ⇒ Object
32 33 34 |
# File 'lib/rspider/UrlStorage.rb', line 32 def <<(u) @cache.set("#{u}","N",86400,true) end |
#pop ⇒ Object
35 36 |
# File 'lib/rspider/UrlStorage.rb', line 35 def pop() end |
#visited(u) ⇒ Object
37 38 39 |
# File 'lib/rspider/UrlStorage.rb', line 37 def visited(u) @cache.set("#{u}","Y",86400,true) end |
#visited?(u) ⇒ Boolean
40 41 42 |
# File 'lib/rspider/UrlStorage.rb', line 40 def visited?(u) @cache.get("#{u}",true) == "Y" end |