KiokuDB::Meta::Attribute::Lazy(3pm)

KiokuDB::Meta::Attribute::Lazy3pm

Trait for lazy loaded attributes

Usage

    # in your class:
    package Foo;
    use KiokuDB::Class;
    has bar => (
        traits => [qw(KiokuDB::Lazy)],
        isa => "Bar",
        is  => "ro",
    );
    # Later:
    my $foo = $dir->lookup($id);
    # bar is not yet loaded, it will be lazily fetched during this call:
    $foo->bar;

Version

version 0.57

Overview

This Moose::Meta::Attribute trait provides lazy loading on a per field basis for objects stored in KiokuDB.

Instead of using proxy objects with AUTOLOAD, overloading, or similar hacks, you can declaratively specify which attributes you want to make lazy, and this will be done cleanly through the MOP.

This is implemented by using a placeholder object, KiokuDB::Thunk which contains references to the ID and the linker, and KiokuDB::Meta::Instance will know to replace the placeholder with the actual loaded object when it is fetched from the object by an accessor.

Releases

6 releases since Debian 7 (Wheezy); the text changed 2 times.

  1. 7
  2. 8–10
  3. 12–13

Author

Yuval Kogman <[email protected]>

From libkiokudb-perl 0.57-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.