NAME

Redis::AOF::Tail::File - Read redis aof file in realtime

SYNOPSIS

  use Redis::AOF::Tail::File;

	my $aof_file = "/var/redis/appendonly.aof";
	my $redis_aof = Redis::AOF::Tail::File->new(aof_filename => $aof_file);
	while (my $cmd = $redis_aof->read_command)
	{
  	print "[$cmd]\n";
	}

DESCRIPTION

This extension can be used for persistence data from redis to MySQL. Maybe you can code like below.

	use DBI;
  use Redis::AOF::Tail::File;

	# variables in this comment should be defined
	# $data_source, $username, $auth, \%attr, 
	# some_func_translate_redis_command_to_sql()
	
  my $dbh = DBI->connect($data_source, $username, $auth, \%attr);
	my $aof_file = "/var/redis/appendonly.aof";
	my $redis_aof = Redis::AOF::Tail::File->new(aof_filename => $aof_file);
	while (my $cmd = $redis_aof->read_command)
	{
  	my $sql = some_func_translate_redis_command_to_sql($cmd);
		$dbh->do($sql);
	}
	

EXPORT

None by default.

SEE ALSO

Redis::Term, Redis

AUTHOR

Chen Gang, <yikuyiku.com@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2014 by Chen Gang

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.16.2 or, at your option, any later version of Perl 5 you may have available.