Static context
Saturday, 4 February 2017 · 3 messages
ML
Marco Lettere4 Feb 2017 19:30 #
Hi BaseX community,
I'm wondering whether there is the possibility to keep some kind of in-memory state among successive RestXQ invocations.
I know I could use the session object but this comes at the risk of loosing the state at session expiration.
I could of course use a DB but with this solution I'm not sure that paying the overhead of accessing a database is worth for the small checks I need to perform.
I was thinking of using Java and create some sort of singleton but this would introduce an unnecessary dependency from a custom jar.
Maybe with the Jobs module? Any other clue?
Thanks,
Marco.
CG
Christian Grün4 Feb 2017 19:35 #
Hi Marco,
Sessions and databases is definitely what I would recommend here. Alternatively, could also store data to files on disk. If you need to store user data,
user:update-info and user:info would be additional choices.
Reports from other users are welcome.
ChristianQuoted text · Marco Lettere · 25 lines
Am 04.02.2017 7:30 nachm. schrieb "Marco Lettere" <m.lettere at gmail.com>: > Hi BaseX community, > > I'm wondering whether there is the possibility to keep some kind of > in-memory state among successive RestXQ invocations. > > I know I could use the session object but this comes at the risk of > loosing the state at session expiration. > > I could of course use a DB but with this solution I'm not sure that paying > the overhead of accessing a database is worth for the small checks I need > to perform. > > I was thinking of using Java and create some sort of singleton but this > would introduce an unnecessary dependency from a custom jar. > > Maybe with the Jobs module? Any other clue? > > Thanks, > > Marco. > > > >
EC
Emmanuel Chateau4 Feb 2017 20:40 #
As, by definition, REST suppose without server-side states, I’m not sure about the constitance of introducing states in RESTXQ. http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm <http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm>
Best regards,
Emmanuel
Quoted text · Christian Grün · 35 lines
> Le 4 févr. 2017 à 13:35, Christian Grün <christian.gruen at gmail.com> a écrit : > > Hi Marco, > > Sessions and databases is definitely what I would recommend here. Alternatively, could also store data to files on disk. If you need to store user data, user:update-info and user:info would be additional choices. > > Reports from other users are welcome. > Christian > > > > > > > > > Am 04.02.2017 7:30 nachm. schrieb "Marco Lettere" <m.lettere at gmail.com <mailto:m.lettere at gmail.com>>: > Hi BaseX community, > > I'm wondering whether there is the possibility to keep some kind of in-memory state among successive RestXQ invocations. > > I know I could use the session object but this comes at the risk of loosing the state at session expiration. > > I could of course use a DB but with this solution I'm not sure that paying the overhead of accessing a database is worth for the small checks I need to perform. > > I was thinking of using Java and create some sort of singleton but this would introduce an unnecessary dependency from a custom jar. > > Maybe with the Jobs module? Any other clue? > > Thanks, > > Marco. > > >
Written for BaseX 8.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery