2015-01-07 15:37:02 +01:00
|
|
|
|
import HDF5, JLD
|
2015-01-07 11:20:48 +01:00
|
|
|
|
|
2015-01-07 15:37:02 +01:00
|
|
|
|
function write_cache(doc::WeaveDoc, cache_path)
|
|
|
|
|
isdir(cache_path) || mkdir(cache_path)
|
|
|
|
|
name = "$cache_path/$(doc.basename).jld"
|
|
|
|
|
JLD.save(name, "doc", doc)
|
|
|
|
|
#open(name, "w") do io
|
|
|
|
|
# write(io, JSON.json(doc))
|
|
|
|
|
#end
|
|
|
|
|
return nothing
|
|
|
|
|
end
|
2015-01-07 11:20:48 +01:00
|
|
|
|
|
2015-01-07 15:37:02 +01:00
|
|
|
|
function read_cache(doc::WeaveDoc, cache_path)
|
|
|
|
|
name = "$cache_path/$(doc.basename).jld"
|
|
|
|
|
isfile(name) || return nothing
|
|
|
|
|
return JLD.load(name, "doc")
|
|
|
|
|
#parsed = JSON.parsefile(name)
|
|
|
|
|
#doc = WeaveDoc(parsed["source"], parsed["chunks"],
|
|
|
|
|
#parsed["cwd"], parsed["doctype"])
|
2015-01-07 11:20:48 +01:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
2015-01-07 15:37:02 +01:00
|
|
|
|
|
2015-01-07 11:20:48 +01:00
|
|
|
|
#Todo caching of data, can get the contents of module using:
|
|
|
|
|
#names(ReportSandBox, all=true)
|