UriCache

Cache data for URIs

(defined in /src/UriCache.coffee:12)
class UriCache

	constructor: (@cacheDir) ->

Parameters

(None)

Parameters

NameTypeDescription
cbFunction()
(defined in /src/UriCache.coffee:45)
clear : (cb)->
	Fs.readdir @cacheDir, (err, relFiles) =>
		Async.each relFiles, (relFile, done) =>
			Fs.unlink Path.join(@cacheDir, relFile), done
		, cb

Parameters

NameTypeDescription
uriString
cbFunction()
(defined in /src/UriCache.coffee:35)
get : (uri, cb) ->
	fname = Path.join(@cacheDir, Utils.uriToFilename(uri))
	Fs.readFile fname, {encoding: 'utf-8'}, (err, data) ->
		return cb err if err
		return cb null, data
(defined in /src/UriCache.coffee:18)
initialize : (cb) ->
	MkdirP @cacheDir, cb

Parameters

NameTypeDescription
uriString
dataString
cbFunction()
(defined in /src/UriCache.coffee:27)
put : (uri, data, cb) ->
	Fs.writeFile Path.join(@cacheDir, Utils.uriToFilename(uri)), data, cb