Rose::DB::Object::Std::Cached(3pm)

Rose::DB::Object::Std::Cached3pm

Memory cached standardized object representation of a single row in a database table.

Usage

  package Category;
  use base 'Rose::DB::Object::Std::Cached';
  __PACKAGE__->meta->setup
  (
    table => 'categories',
    columns =>
    [
      id          => { type => 'int', primary_key => 1 },
      name        => { type => 'varchar', length => 255 },
      description => { type => 'text' },
    ],
    unique_key => 'name',
  );
  ...
  $cat1 = Category->new(id   => 123,
                        name => 'Art');
  $cat1->save or die $category->error;
  $cat2 = Category->new(id => 123);
  # This will load from the memory cache, not the database
  $cat2->load or die $cat2->error; 
  # $cat2 is the same object as $cat1
  print "Yep, cached"  if($cat1 eq $cat2);
  # No, really, it's the same object
  $cat1->name('Blah');
  print $cat2->name; # prints "Blah"
  ...

Overview

"Rose::DB::Object::Std::Cached" is a subclass of both Rose::DB::Object::Std and Rose::DB::Object::Cached. It simply combines the features of both classes. See the Rose::DB::Object::Std and Rose::DB::Object::Cached documentation for more information.

Releases

9 releases since Debian 5.0 (Lenny); the text changed 7 times.

  1. 5.0
  2. 6.0
  3. 7
  4. 8
  5. 9
  6. 10
  7. 11
  8. 12–13

Author

John C. Siracusa ([email protected])

License

Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

From librose-db-object-perl 1:0.820-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.