Skip to content
dandv edited this page Sep 13, 2010 · 8 revisions

General

Why are my objects not up to date?

A: If your data structure has cycles then objects may leak and therefore stay alive for too long.

Catalyst::Model::KiokuDB will report leaks and work around them by removing the live objects from the live object set, but won’t fix the actual memory leak.

Use Test::Memory::Cycle to check for leaks in your model’s unit tests, and use Moose’s weak_ref option for attributes or weaken for other cycles.

Data Types

If my Moose object has an ArrayRef[Foo] or HashRef[Foo], do I need to convert that to a KiokuDB::Set?

A: No. If you keep the ArrayRef or HashRef, your objects will still be transparently persisted, but KiokuDB will not be able to lazy load the objects referenced by the array or hash. If you do use a KiokuDB::Set, the declaration won’t be as clear (has children => (does => 'KiokuDB::Set'); # what kind of set?), but KiokuDB will be able to load the children lazily.

To address the declaration clarity, you can create subtypes of KiokuDB::Set. See an example in Golf::Domain::Player and the type definition in Golf::Domain::Meta::Types).

What data types can KiokuDB store?

A: Simple values like scalars, arrays, hashes, as well as:

  • Objects
  • Weak references
  • Tied variables (by storing the object)
  • Closures
  • GLOBs (but not ones with filehandles, and without preserving the name)

How can I page search results?

A: This is not possible at the moment, but result paging is in the works.