Dave Rolsky > Fey-ORM-0.30 > Fey::Object::Iterator::FromSelect::Caching

Download:
Fey-ORM-0.30.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs

Module Version: 0.30   Source  

NAME ^

Fey::Object::Iterator::FromSelect::Caching - A caching subclass of Fey::Object::Iterator::FromSelect

SYNOPSIS ^

  use Fey::Object::Iterator::FromSelect::Caching;

  my $iter =
      Fey::Object::Iterator::FromSelect::Caching->new
          ( classes     => 'MyApp::User',
            select      => $select,
            dbh         => $dbh,
            bind_params => \@bind,
          );

  print $iter->index(); # 0

  while ( my $user = $iter->next() )
  {
      print $iter->index(); # 1, 2, 3, ...
      print $user->username();
  }

  # will return cached objects now
  $iter->reset();

DESCRIPTION ^

This class implements a caching subclass of Fey::Object::Iterator::FromSelect::FromSelect. This means that it caches objects it creates internally. When $iterator->reset() is called it will re-use those objects before fetching more data from the DBMS.

METHODS ^

This class provides the following methods:

$iterator->reset()

Resets the iterator so that the next call to $iterator->next() returns the first objects. Internally, this does not reset the DBI statement handle, it simply makes the iterator use cached objects.

$iterator->clone()

Clones the iterator while sharing its cached data with the original object. This is really intended for internal use, so use at your own risk.

ROLES ^

This class does the Fey::ORM::Role::Iterator role.

AUTHOR ^

Dave Rolsky, <autarch@urth.org>

BUGS ^

See Fey::ORM for details.

COPYRIGHT & LICENSE ^

Copyright 2006-2009 Dave Rolsky, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module.