保存データを永続化する
Kaiでは,
これにより,
ただし,
基本的にKaiで保存先にディスクを指定するのは,
では,
リスト2 kai_
[{kai, [
{rpc_port, 11011},
{rpc_max_processes, 30},
{memcache_port, 11211},
{memcache_max_processes, 10},
{max_connections, 32},
{n, 1},
{r, 1},
{w, 1},
{number_of_buckets, 1024},
{number_of_virtual_nodes, 128},
{store, dets},
{dets_dir, "/path/to/kai-0.4.0/data"},
{number_of_tables, 256}
]}].
kai_
設定名 | 変更前の値 | 変更後の値 |
---|---|---|
store | ets | dets |
dets_ | "/path/ |
Erlangには,
Kaiは,
また,
次に,
$ mkdir -p /path/to/kai-0.4.0/data
以上で,
$ erl -pa ebin -config kai_dets -eval 'application:start(kai).' Erlang R13B (erts-5.7.1) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.7.1 (abort with ^G) 2009-05-24 01:46:49.832265 [info] (<0.43.0>) ./kai_hash.erl:183: {update, [{{{192,168,1,2},11011}, [{number_of_virtual_nodes, 128}]}], []} 1>
筆者がMac OSX 10.
それでは,
まず始めに,
リスト3 kai_
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests => 1;
use Cache::Memcached;
my $mem = Cache::Memcached->new({
servers => ['127.0.0.1:11211'],
});
$mem->set(foo => 'bar', 0,);
is $mem->get('foo'), 'bar';
用意したPerl Scriptを実行し,
$ /path/to/kai_test_dets.pl 1..1 ok 1
次に,
1> q(). ok $ erl -pa ebin -config kai_dets -eval 'application:start(kai).'
最後に,
次のようなPerl Scriptを用意し,
リスト4 kai_
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests => 1;
use Cache::Memcached;
my $mem = Cache::Memcached->new({
servers => ['127.0.0.1:11211'],
});
is $mem->get('foo'), 'bar';
用意したPerl Scriptを実行し,
$ /path/to/kai_test_dets_get.pl 1..1 ok 1
このような実行結果となれば,