Class: Rspider::ContentStorage

Inherits:
Hash
  • Object
show all
Defined in:
lib/rspider/ContentStorage.rb

Overview

this class store the content of documents in Hash (memory) So program uses lots of memory and can play fast

Instance Method Summary collapse

Constructor Details

#initializeContentStorage

Returns a new instance of ContentStorage.



15
16
# File 'lib/rspider/ContentStorage.rb', line 15

def initialize()
end

Instance Method Details

#add(url, content) ⇒ Object

store an url and content of the url



18
19
20
# File 'lib/rspider/ContentStorage.rb', line 18

def add(url,content)
	self[url]=content
end

#closeObject

close the db



26
27
# File 'lib/rspider/ContentStorage.rb', line 26

def close
end

#get(url) ⇒ Object

get the content of url #url



29
30
31
# File 'lib/rspider/ContentStorage.rb', line 29

def get(url)
	return self[url]
end

#urlsObject

list the urls



22
23
24
# File 'lib/rspider/ContentStorage.rb', line 22

def urls
	self.keys
end