How to use Jackalope sessions in a web application

9 views
Skip to first unread message

gg

unread,
Jan 19, 2012, 7:27:12 AM1/19/12
to PHPCR User Group Mailinglist
Need some clarification on how the session object that is created
using,

$this->session = $repository->login($credentials, $workspace);

should be used?

Should this session object be stored at user level, application level
or request level? Is the session object safe to be used by multiple
threads?

Thanks,
gg

David Buchmann

unread,
Jan 19, 2012, 8:19:58 AM1/19/12
to phpcr...@googlegroups.com, jackal...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi,

> Should this session object be stored at user level, application level
> or request level? Is the session object safe to be used by multiple
> threads?

at which level you use the object depends on what you want to do. think
of it as of one connection to the database.
by nature of phpcr, modifications first happen to the session and are
only persisted on save(). so if you do write operations, you probably do
not want to share that session with other things that are not aware of
what you do.
if the acl part of phcpr was implemented in jackalope you would want to
use individual sessions per user to have the right permissions applied.
at the moment however, this is probably not relevant.
if you can reuse the same session over multiple requests, it will be a
big performance gain as things read from the backend are cached locally.
at some point you will need to restart the session though, to avoid the
cache growing too big.

for threads, i fear this will not work at the moment. we never tried it
and do nothing to protect against all the ugly things you can get with
threads. if you have experience in that area and would be motivated to
review jackalope in that respect and maybe even send pull requests, that
would be awesome.

cheers,david
- --
Liip AG // Agile Web Development // T +41 26 422 25 11
CH-1700 Fribourg // PGP 0xA581808B // www.liip.ch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8YGH4ACgkQqBnXnqWBgItb+wCfRp9FMt5qpk0V6tBQNCTZRl98
07wAn3KWu4sTXZT/wNE+agn6izC1MfRd
=qrL+
-----END PGP SIGNATURE-----

Reply all
Reply to author
Forward
0 new messages