Re: [basex-talk] Server Variables, cached vars, etc

2017-09-05 Thread Erik Peterson
Thank you all for your replys.  It looks like a main memory database is the
best "built in" option.  However, I have created Jar file  to drop him/lib
with a Java Singleton object...holding a map.  That should be  accessible
across requests and sessions.   The question is how to populate this just
once upon start up?  Perhaps I could do a job that would do that?  Also I
could memoize the variables in a global script.  That way the expensive
operation is only run the first time it is needed.

Any other suggestions welcome.  Recommend that a standard built-in feature
 be added to handle these scenarios.

On Tue, Sep 5, 2017 at 1:33 AM Fabrice ETANCHAUD <
fetanch...@pch.cerfrance.fr> wrote:

> To be confirmed : there is no 'start script' server option.
> I do manually create and populate the mainmem db in the dba query
> interface.
>
> Best regards,
> Fabrice
>
> -Message d'origine-
> De : Fabrice ETANCHAUD
> Envoyé : mardi 5 septembre 2017 09:29
> À : 'Marco Lettere'; basex-talk@mailman.uni-konstanz.de
> Objet : RE: [basex-talk] Server Variables, cached vars, etc
>
> Hi all,
>
> Another solution is to share a main memory database, that behaves like a
> memory cache.
> In Client/Server mode, any main memory created by one client is available
> to all the other ones.
>
> Best regards,
> Fabrice
>
>
> -Message d'origine-
> De : basex-talk-boun...@mailman.uni-konstanz.de [mailto:
> basex-talk-boun...@mailman.uni-konstanz.de] De la part de Marco Lettere
> Envoyé : mardi 5 septembre 2017 09:14 À :
> basex-talk@mailman.uni-konstanz.de
> Objet : Re: [basex-talk] Server Variables, cached vars, etc
>
> On 05/09/2017 01:37, Erik Peterson wrote:
> > How can I create a variable that is evaluated only once but accessed
> > across many RestXQ requests and sessions. I'm trying to cache data
> > that comes from an integration with an expensive operation. Does BaseX
> > support something similar to server variables like Mark Logic?
>
> Hi Erik,
>
> AFAIK you have the following possibilities to keep a variable live accross
> multiple RestXQ calls:
>
> 1) Use session http://docs.basex.org/wiki/Session_Module
>
> 2) Use a database which is builtin in BaseX and is very lightweight.
> Especially if your data is serializable to XML you could benefit also from
> indexes to speed up access to your cached objects.
>
> 3) Use the file system.
>
> Hope this helps [cit] ;-)
>
> Marco.
>
> --
*Erik Peterson*
President, Ardec LLC
281-804-9023 | e...@ardec.com


Re: [basex-talk] Server Variables, cached vars, etc

2017-09-05 Thread Fabrice ETANCHAUD
To be confirmed : there is no 'start script' server option.
I do manually create and populate the mainmem db in the dba query interface.

Best regards,
Fabrice

-Message d'origine-
De : Fabrice ETANCHAUD 
Envoyé : mardi 5 septembre 2017 09:29
À : 'Marco Lettere'; basex-talk@mailman.uni-konstanz.de
Objet : RE: [basex-talk] Server Variables, cached vars, etc

Hi all,

Another solution is to share a main memory database, that behaves like a memory 
cache.
In Client/Server mode, any main memory created by one client is available to 
all the other ones.

Best regards,
Fabrice


-Message d'origine-
De : basex-talk-boun...@mailman.uni-konstanz.de 
[mailto:basex-talk-boun...@mailman.uni-konstanz.de] De la part de Marco Lettere 
Envoyé : mardi 5 septembre 2017 09:14 À : basex-talk@mailman.uni-konstanz.de
Objet : Re: [basex-talk] Server Variables, cached vars, etc

On 05/09/2017 01:37, Erik Peterson wrote:
> How can I create a variable that is evaluated only once but accessed 
> across many RestXQ requests and sessions. I'm trying to cache data 
> that comes from an integration with an expensive operation. Does BaseX 
> support something similar to server variables like Mark Logic?

Hi Erik,

AFAIK you have the following possibilities to keep a variable live accross 
multiple RestXQ calls:

1) Use session http://docs.basex.org/wiki/Session_Module

2) Use a database which is builtin in BaseX and is very lightweight. 
Especially if your data is serializable to XML you could benefit also from 
indexes to speed up access to your cached objects.

3) Use the file system.

Hope this helps [cit] ;-)

Marco.



Re: [basex-talk] Server Variables, cached vars, etc

2017-09-05 Thread Kendall Shaw
A problem with that is that it evaluates the variable each time. If you need it 
to only evaluate once (expensive operation), something else needs to be done. I 
would like to know an answer to this so that I can schedule jobs on start up 
without involving processes external to basex.

From:  on behalf of Xavier-Laurent 
SALVADOR 
Date: Monday, September 4, 2017 at 11:42 PM
To: Erik Peterson 
Cc: BaseX 
Subject: Re: [basex-talk] Server Variables, cached vars, etc

Hi,

do you mean something like a repo variable ?

If you define a module name in your repo:

 1-  module namespace myNs = 
'http://www.x.fr/-repo’;

You can define in your repo a new variable :

 1-declare variable $myNs:testid :=  
db:open(‘x')/utilisateurs/entry/sessions/session/id=session:id();

Then import your module in your restxq:

  1-   import module namespace isi = 
'http://www.isilex.fr/isi-repo’;

And access your variables:

  1-$myNs:testid

More here: 
http://docs.basex.org/wiki/XQuery_3.0#External_Variables

Sorry If I’m wrong and didn’t understand,

XLS
Le 5 sept. 2017 à 01:37, Erik Peterson > 
a écrit :

How can I create a variable that is evaluated only once but accessed across 
many RestXQ requests and sessions. I'm trying to cache data that comes from an 
integration with an expensive operation. Does BaseX support something similar 
to server variables like Mark Logic?




Re: [basex-talk] Server Variables, cached vars, etc

2017-09-05 Thread Fabrice ETANCHAUD
Hi all,

Another solution is to share a main memory database, that behaves like a memory 
cache.
In Client/Server mode, any main memory created by one client is available to 
all the other ones.

Best regards,
Fabrice


-Message d'origine-
De : basex-talk-boun...@mailman.uni-konstanz.de 
[mailto:basex-talk-boun...@mailman.uni-konstanz.de] De la part de Marco Lettere
Envoyé : mardi 5 septembre 2017 09:14
À : basex-talk@mailman.uni-konstanz.de
Objet : Re: [basex-talk] Server Variables, cached vars, etc

On 05/09/2017 01:37, Erik Peterson wrote:
> How can I create a variable that is evaluated only once but accessed 
> across many RestXQ requests and sessions. I'm trying to cache data 
> that comes from an integration with an expensive operation. Does BaseX 
> support something similar to server variables like Mark Logic?

Hi Erik,

AFAIK you have the following possibilities to keep a variable live accross 
multiple RestXQ calls:

1) Use session http://docs.basex.org/wiki/Session_Module

2) Use a database which is builtin in BaseX and is very lightweight. 
Especially if your data is serializable to XML you could benefit also from 
indexes to speed up access to your cached objects.

3) Use the file system.

Hope this helps [cit] ;-)

Marco.



Re: [basex-talk] Server Variables, cached vars, etc

2017-09-05 Thread Marco Lettere

On 05/09/2017 01:37, Erik Peterson wrote:
How can I create a variable that is evaluated only once but accessed 
across many RestXQ requests and sessions. I'm trying to cache data 
that comes from an integration with an expensive operation. Does BaseX 
support something similar to server variables like Mark Logic?


Hi Erik,

AFAIK you have the following possibilities to keep a variable live 
accross multiple RestXQ calls:


1) Use session http://docs.basex.org/wiki/Session_Module

2) Use a database which is builtin in BaseX and is very lightweight. 
Especially if your data is serializable to XML you could benefit also 
from indexes to speed up access to your cached objects.


3) Use the file system.

Hope this helps [cit] ;-)

Marco.



Re: [basex-talk] Server Variables, cached vars, etc

2017-09-05 Thread Xavier-Laurent SALVADOR
Hi,

do you mean something like a repo variable ?

If you define a module name in your repo:

 1-  module namespace myNs = 'http://www.x.fr/-repo’ 
;

You can define in your repo a new variable :

 1-declare variable $myNs:testid :=  
db:open(‘x')/utilisateurs/entry/sessions/session/id=session:id();

Then import your module in your restxq:

  1-   import module namespace isi = 'http://www.isilex.fr/isi-repo’ 
;

And access your variables: 

  1-$myNs:testid

More here: http://docs.basex.org/wiki/XQuery_3.0#External_Variables 


Sorry If I’m wrong and didn’t understand,

XLS
> Le 5 sept. 2017 à 01:37, Erik Peterson  a écrit :
> 
> How can I create a variable that is evaluated only once but accessed across 
> many RestXQ requests and sessions. I'm trying to cache data that comes from 
> an integration with an expensive operation. Does BaseX support something 
> similar to server variables like Mark Logic?