Fey::Object::Iterator::FromSelect::Caching - A caching subclass of Fey::Object::Iterator::FromSelect
version 0.47
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();
This class implements a caching subclass of Fey::Object::Iterator::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.
$iterator->reset()
This class provides the following methods:
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->next()
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.
This class does the Fey::ORM::Role::Iterator role.
Dave Rolsky <autarch@urth.org>
This software is copyright (c) 2011 - 2015 by Dave Rolsky.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Fey::ORM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Fey::ORM
CPAN shell
perl -MCPAN -e shell install Fey::ORM
For more information on module installation, please visit the detailed CPAN module installation guide.