in reply to Json and blessed references
You can choose a file backend if you don't want to use a database (although you lose querying capabilities), and you have control over what engine is used to collapse the objects (JSON, Storable, YAML). You get the most speed with Storable, but with JSON and YAML you get readable (and possibly editable) dumps.{ package Foo; use Moose; # Not necessary, but advisable # class definition } my $foo = Foo->new; use KiokuDB; use feature 'say'; # You can also use a file and an in-memory hash backend instead of DBI my $db = KiokuDB->new( dsn => 'dbi:SQLite:db=mydb' ); my $scope = $db->new_scope; # Store the object my $id = $db->insert($foo); undef $foo; # retrieve the object using id lookup $foo = $db->lookup($id); say ref $foo; # 'Foo'
It takes a little to learn, but KiokuDB::Tutorial is probably the best place to start.
|
|---|