locked
V4 print drivers: Is there any way to cache runtime data between invocations of JavaScript constraint API?

    Question

  • Hello,

    I am developing the JavaScript constraint script for V4 print driver, and I currently have some performance issues in it.

    I tried to implement data caching which would cache some runtime data in global object between API function invocations, so that this data is calculated only once. I presumed there might be some sort of session which supposedly span several API invocations. However this didn't work because the JavaScript global object seemed to be cleared before each call to API function.

    Is there possibly any other way to save runtime data in JavaScript constraint script between invocations?

    Thank you.

    Tuesday, June 26, 2012 6:53 AM

Answers

  • Hi Kondakovdmitry,

    We build the script site every time the user calls PTOpenProvider. As a result, there's no guarantee of any data continuity across calls.

    I will note that we do have the user property bag, which could be used for some data storage, but you need to carefully evaluate whether this addresses your performance concerns since using this will involve serialization of data to disk.

    Thanks!

    Justin

    Tuesday, June 26, 2012 10:37 PM

All replies

  • Hi Kondakovdmitry,

    We build the script site every time the user calls PTOpenProvider. As a result, there's no guarantee of any data continuity across calls.

    I will note that we do have the user property bag, which could be used for some data storage, but you need to carefully evaluate whether this addresses your performance concerns since using this will involve serialization of data to disk.

    Thanks!

    Justin

    Tuesday, June 26, 2012 10:37 PM
  • Hello Justin,

    Thank you for your answer!

    I just thought that the user property bag is not write-accessible from within JavaScript (is it really?). Anyway, using it will not improve performance in our case, due to the serialization you mentioned (in fact, what I am trying to do - is to avoid the deserialization of data from driver property bag, which we do on each API call).

    So, if there's nothing else, I think we'll have to generate JavaScript for each printer model to improve performance...

    Thank you.

    Dmitry.

    Wednesday, June 27, 2012 5:51 AM