|
|
@ -47,9 +47,17 @@ function CreDocument:cacheInit()
|
|
|
|
if lfs.attributes("./cr3cache", "mode") == "directory" then
|
|
|
|
if lfs.attributes("./cr3cache", "mode") == "directory" then
|
|
|
|
os.execute("rm -r ./cr3cache")
|
|
|
|
os.execute("rm -r ./cr3cache")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- crengine various in-memory caches max-sizes are rather small
|
|
|
|
|
|
|
|
-- (2.5 / 4.5 / 1.5 / 1 MB), and we can avoid some bugs if we
|
|
|
|
|
|
|
|
-- increase them. Let's multiply them by 20 (each cache would
|
|
|
|
|
|
|
|
-- grow only when needed, depending on book characteristics).
|
|
|
|
|
|
|
|
-- People who would get out of memory crashes with big books on
|
|
|
|
|
|
|
|
-- older devices can decrease that with setting:
|
|
|
|
|
|
|
|
-- "cre_storage_size_factor"=1 (or 2, or 5)
|
|
|
|
|
|
|
|
local default_cre_storage_size_factor = 20
|
|
|
|
cre.initCache(DataStorage:getDataDir() .. "/cache/cr3cache", 1024*1024*32,
|
|
|
|
cre.initCache(DataStorage:getDataDir() .. "/cache/cr3cache", 1024*1024*32,
|
|
|
|
G_reader_settings:nilOrTrue("cre_compress_cached_data"),
|
|
|
|
G_reader_settings:nilOrTrue("cre_compress_cached_data"),
|
|
|
|
G_reader_settings:readSetting("cre_storage_size_factor"))
|
|
|
|
G_reader_settings:readSetting("cre_storage_size_factor") or default_cre_storage_size_factor)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function CreDocument:engineInit()
|
|
|
|
function CreDocument:engineInit()
|
|
|
|