Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
package NoticeBackend::Author;
use Mojo::Base 'Mojolicious::Controller';
use 5.12.0;
use warnings;
use utf8;
use MojoX::Redis;
use Mojo::IOLoop;
my $redis = MojoX::Redis->new(server => '192.168.1.20:6379');
my ($redis_out);
sub get{
my $self = shift;
my $user_query = $self->req->is_xhr ?
$self->req->json->{'name'} : $self->param('name');
my $callback_name = $self->req->is_xhr ?
$self->req->json->{'callback'} : $self->param('callback');
my $data_out;
$redis->ioloop(Mojo::IOLoop->new);
$redis->get( $user_query => sub {
my ($redis, $res) = @_;
$data_out = $res->[0];
$redis->stop;
});
$redis->start;
$self->render( text => "|$data_out|" );
};
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.