NAME

Test::Fixture::KyotoTycoon - load fixture data to kyototycoon

VERSION

0.13

SYNOPSIS

# in your t/fixture.yaml
---
-
  key: foo
  value: bar
-
  key: array
  value:
    - 1
    - 2
    - 3
    - 4
    - 5
-
  key: hash
  value:
    apple: red
    banana: yellow
-
  namespace: "app:"
  key: nirvana
  value: smells like teen split
-
  key: xt
  value: bar
  xt: 3

# in your t/*.t
use Test::Fixture::KyotoTycoon;
## $kt is Cache::KyotoTycoon instance
my $data = construct_fixture kt => $kt, fixture => "t/fixture.yaml";

DESCRIPTION

Test::Fixture::KyotoTycoon is fixture data loader for Cache::KyotoTycoon.

METHODS

construct_fixture

load to ktserver

Example:

use Cache::KyotoTycoon;
use Test::Fixture::KyotoTycoon;

# basic sample
my $kt = Cache::KyotoTycoon->new(host = "127.0.0.1");
my $fixture = "/path/to/fixture.yaml";
my $data = construct_fixture kt => $kt, fixture => $fixture;

Options:

kt           Cache::KyotoTycoon instance
fixture      fixture yaml path or ARRAY reference
serializer   custom serializer(optional. default Storable::nfreeze)

Custom Serializer Example(using Data::MessagePack)

use Cache::KyotoTycoon;
use Test::Fixture::KyotoTycoon;
use Data::MessagePack;

my $kt = Cache::KyotoTycoon->new(host = "127.0.0.1");
my $fixture = "/path/to/fixture.yaml";
my $data = construct_fixture kt => $kt, fixture => $fixture, serializer => sub { Data::MessagePack->pack(+shift) };

FIXTURE

YAML format or ARRAY reference

Fields:

namespace  namespace. type:str(optional)
key        key name. type:str
value      value. type:any
xt         expiration time. see Cache::KyotoTycoon manual

AUTHOR

holly <emperor.kurt@gmail.com>

SEE ALSO

Cache::KyotoTycoon Kwalify YAML::XS

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.