Thomas,

Have you some hints to share with us to implement some caching system for Nested Set ?
I am interested in implement a common caching system for trees implementations (Nested Set or Materialized Path).

ErIC

On 12/24/06, Thomas Rabaix <thomas@rabaix.net> wrote:
Hello,

Do you have plan to create a caching system for the nested set ? For
one project I serialize/desrialize the node root, and I have made a
benchmark and I get this results:
  - loading from database : 0.18s
  - loading from serialization : 0.014s

The benchmark is made over 1000 rows and propel 1.2

Thomas

On 24 déc. 06, at 11:52, Eric Fredj wrote:

> Ok, as promised, I made a patch on 1.3 branch in order to add
> NestedSet support.
>
> I didn't commit it because, I am not currently satisfied.
> Indeed, it is fully usable but it requires to use a specific Stub
> and StubPeer in parallel with default ones.
>
> So I decided to work now on an really integrated way to use
> NestedSet in a transparent way...
>
> Now provided features:
> New builder to generate NestedSet object, peer and their stubs
> Support for Iterator on NestedSet node in order to use it in a
> PreOrderTraversal way
> Support for IteratorAggregate to retrieve right Iterator to use
> Extended PropelPDO to add logging in prepare() method
> Example insertion usage
> $menu = new MenuNestedSet();
> $menu->setText('Google');
> $menu->setLink('http://www.google.com');
>
> MenuNestedSetPeer::createRoot($menu);
>
> $child = new MenuNestedSet();
> $child->setText('Google Mail');
> $child->setLink('http://mail.google.com' );
> $child->insertAsLastChildOf($menu);
>
> $child = new MenuNestedSet();
> $child->setText('Google Maps');
> $child->setLink(' http://maps.google.com');
> $child->insertAsLastChildOf($menu);
>
> $sibling = new MenuNestedSet();
> $sibling->setText('Yahoo!');
> $sibling->setLink(' http://www.yahoo.com');
> $sibling->insertAsNextSiblingOf($menu);
>
> $child = new MenuNestedSet();
> $child->setText('Yahoo! Mail');
> $child->setLink(' http://mail.yahoo.com');
>
> $child->insertAsLastChildOf($sibling);
> Example Ttaversal usage
>     $node = MenuNestedSetPeer::retrieveRoot();
>     $level = 0;
>     foreach($element as $node) {
>         if($level < $node->getLevel()) {
>             // Go deep (to leaf) in tree
>         } else if ($level > $node->getLevel()) {
>             // Go up (to root) in tree
>         } else {
>             // Stay in same level
>         }
>         $level = $node->getLevel();
>     }
>
> Enjoy it.
>
> Happy X-Mas
> ErIC
>
> On 12/18/06, Eric Fredj < eofredj@gmail.com> wrote: Ok, I didn't
> take a look on 1.3 branch until now but I think I can adapt the
> patch quickly.
> I will try to produce before X-Mas.
> By that time, I will attach the 1.2 patch on a Trac ticket when
> phpdb.org will be up :-)
>
> About coding guidelines, I tried to follow NodePeerBuilder*
> convention and all I was able to read on Trac Wiki but feel free to
> comment and make feedback ...
>
> PS :I asked for SVN account a few minutes ago ..
>
> Thx
> ErIC
>
>
>
> On 12/18/06, Hans Lellelid < hans@velum.net> wrote: Hi Eric,
>
> Makes sense, ok.  I think that this makes most sense in the 1.3
> branch,
> as it would break 1.2 BC (and 1.3 is not far from being ready).
> So, if
> you want to create a ticket (or find that original ticket, if there is
> one) and commit this stuff to 1.3, please do (and thanks!).  Please
> see
> coding & contributing guidelines, of course.  Also let me know if you
> need SVN account.
>
> Thanks,
> Hans
>
>
> Eric Fredj wrote:
> > I forgot the main : I obviously made some specific NestedSet builder
> > for Base classes and Stub classes ...
> >
> > On 12/18/06, *Eric Fredj* < eofredj@gmail.com
> > <mailto:eofredj@gmail.com>> wrote:
> >
> >     Patch was made in mind to be integrated in main tree because it
> >     requires some changes on the core:
> >
> >         * database.xsd was updated to support some new attributes in
> >           schema.xml
> >               o In fact, I replaced isTree by treeMode in Table
> >                 attribute to support several mode
> >               o I added some Column attribute to target left and
> right
> >                 fields
> >         * PropelOMTask.php was modified to managed the new treeMode
> >           and call the new builder I added when needed
> >         * Column.php and Table.php to handle their new attributes
> >         * OMBuilder.php to handle new attributes and builder
> getter as
> >           it is done for Node builder
> >
> >     Maybe the right way to share would be to create a parallel
> >     1.2-nestedset (or something else) branch in which I could commit
> >     my job, improve it, fix it before you can merge it with main 1.2
> >     officiel branch.
> >     Moreover, it could be more easy to develop the same patch for
> 1.3
> >     then...
> >
> >
> >
> >     On 12/18/06, *Hans Lellelid* < hans@velum.net
> >     <mailto: hans@velum.net>> wrote:
> >
> >         Hi Eric,
> >
> >         Depending on what it is you've been creating, I think we can
> >         either add
> >         it to contrib or integrate it into main tree.  My preference
> >         would be to
> >         add it to the contrib directory in SVN.  I can get you an
> SVN
> >         account if
> >         you don't have one yet (please email offlist w/ desired
> username).
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@propel.tigris.org
> For additional commands, e-mail: dev-help@propel.tigris.org
>
>
>
> <1.3-nestedset.diff>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@propel.tigris.org
> For additional commands, e-mail: dev-help@propel.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@propel.tigris.org
For additional commands, e-mail: dev-help@propel.tigris.org