elifesciences / lens

A novel way of viewing eLife articles.
http://lens.elifesciences.org
Other
376 stars 75 forks source link

There are a cache strategy or a way to do server-side pre-processing? #190

Open ppKrauss opened 7 years ago

ppKrauss commented 7 years ago

The convertion process (lens_converter.js) is time consuming... There are a cache strategy for it?

... I have all XML JATS files in a database, that can be pre-processed by Node.js in the server, and cached in the database... But there are a simple way to cache a JSON structure? As I see there are a lot of DOM objects, that will be not saved in a simple JSON structure.


Another advantage to cache is that my server-side converter/lens_converter.js can grow with dozens of Converter.Prototype options without overload the client-side.

CAYdenberg commented 7 years ago

As I understand it, the converter relies on the browser-native DOM parser and won't work in Node. I've toyed with parsing in the browser and then firing the JSON back to the server when complete - but there isn't any obvious way of knowing when the converter has finished - it's all async. (Note that the loading animation you see depends on a setTimeout - it's not necessarily as time consuming as you think it is).

ppKrauss commented 7 years ago

Thanks @CAYdenberg, good analysis. Yes ideal to work with Lens also at server-side, so running with NodeJs... Perhaps we need to open other issue, to suggest it server-side Lens?


About my particular use of Lens. The cache is a way to pre-process, validate and deliver... Some XML (eg. try any PLOS ONE as this sample, testing <ref-list> renderization) need also XSLT pre-processing, but not need to save another XML duplicating it, the easyest way is to save as "LensCache".

Note that the loading animation you see depends on a setTimeout - it's not necessarily as time consuming as you think it is

Perhaps is not so relevant for final users at universities, but we want to offer better experience: the client-CPUtime is not null ... it is order of seconds in old computers and mobile devices (eg. tablets).