The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Class::ReluctantORM::Monitor::QueryCount - Ongoing count of queries

SYNOPSIS

  use aliased 'Class::ReluctantORM::Monitor::QueryCount';
  my $mon = QueryCount->new();
  Class::ReluctantORM->install_global_monitor($mon);
  Pirate->install_class_monitor($mon);

  # Do a query.... logging and highwater scorekeeping happens
  Pirate->fetch(...);

  # Read from the monitor - should increase by 1 or more with each DB operation
  my $count = $mon->last_measured_value();

  # Reset counter to 0
  $mon->reset();

DESCRIPTION

Simply counts the number of times the database is queried. This value may not increase (due to caching by a Registry or Static, a query may not be needed to perform a fetch). Also, some drivers may have to perform two queries to perform an operation (Eg, insert-and-return-values).

This is a Measuring Monitor. Note that highwater tracking is supported, but rather meaningless.