[Cl-perec-devel] Lots of questions :-)

Mihai Bazon mihai at bazon.net
Thu Sep 17 08:26:46 UTC 2009


Hi folks,

Attila Lendvai <attila.lendvai at gmail.com> wrote:
> 
> http://common-lisp.net/cgi-bin/darcsweb/darcsweb.cgi/darcsweb.cgi?r=cl-dwim-cl-dwim;a=headblob;f=/meta-model/authentication.lisp
> 
> the relevant line is this:
> 
> (setf authenticated-session (load-instance authenticated-session
> :skip-existence-check #t :copy-cached-slot-values #t))

I couldn't get this to work -- I still can't access that object outside
a transaction.  But I'm leaving this for now.

The more I dig it, the more I love it.  I like inheritance, for example
-- I created a base class that has an "edition" field and added a
"before-committing" trigger that increments edition. Then all classes
that inherit from it have a magic "version number" that gets updated for
each change.  It's brilliant how it works, using a single table for
versions and views to map each object to its version! Great work guys!

I envision that it will be a lot slower than hand-crafted SQL, but the
ease of development makes it worth.  I have some more questions, mostly
related to optimizing performance:

1. I have a N-M relationship between Users and Groups.  For this, perec
   creates an intermediate table, which is great because I don't have to
   do it myself :-) but not so great because I don't know how I can
   control it.

   When I do (push new-group (grups-of user)) perec deletes all groups
   of that user from the intermediate table, then re-inserts them, which
   makes sense because one can change the whole set of groups at once,
   but in the particular case of adding a new group seems overkill.  I
   was wondering if there is a way to add a single instance.

2. Whenever I access an associated object (or a set, such as (groups-of
   user)) a SELECT is run.  I was wondering if there is a way to have
   "cached" slots (in RAM, that is), at least within a transaction.

3. Is there a way to create INDEX-es on fields other than those created
   by defassociation or :unique slots?

Cheers,
-Mihai



More information about the cl-perec-devel mailing list