NAME
DBIx::QuickORM::RowManager::Cached - Row manager with a per-source identity cache.
DESCRIPTION
A DBIx::QuickORM::RowManager that keeps at most one row object per primary key per source. Rows are stored under a per-source bucket keyed by their primary key and held weakly, so cached rows can be reused while still being garbage collected once no longer referenced.
SYNOPSIS
my $mgr = DBIx::QuickORM::RowManager::Cached->new(connection => $connection);
PUBLIC METHODS
- $row = $mgr->do_cache_lookup($source, $fetched, $old_pk, $new_pk, $row)
-
Return the cached row for the source and primary key, or undef.
- $row = $mgr->cache($source, $row, $old_pk, $new_pk)
-
Store the row in its source bucket under its new primary key (held weakly), removing any entry under the old primary key. Returns the row, or nothing for sources without a primary key.
- $row = $mgr->uncache($source, $row, $old_pk, $new_pk)
-
Remove and return the cached row for the given source and primary key. The primary key is taken from the supplied keys, or from the row itself when none are given.
- $key = $mgr->cache_key($pk)
-
Build a single cache-key string from an arrayref of primary-key values, joining them on a separator that is escaped where it occurs in a value.
SOURCE
The source code repository for DBIx::QuickORM can be found at https://github.com/exodist/DBIx-QuickORM.
MAINTAINERS
AUTHORS
COPYRIGHT
Copyright Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.