diff options
| author | franck cuny <franck@lumberjaph.net> | 2011-06-16 15:10:02 +0200 |
|---|---|---|
| committer | franck cuny <franck@lumberjaph.net> | 2011-06-16 15:38:42 +0200 |
| commit | 3f9633196257eb1ecec0e3b14dfd8096849cc828 (patch) | |
| tree | a6aa5a10908b95a31a341956410cfbe85c73d527 | |
| parent | add new webservice to return informations about a profile (diff) | |
| download | stargit-3f9633196257eb1ecec0e3b14dfd8096849cc828.tar.gz | |
store in memcached
Signed-off-by: franck cuny <franck@lumberjaph.net>
Diffstat (limited to '')
| -rw-r--r-- | Makefile.PL | 34 | ||||
| -rw-r--r-- | lib/StarGit.pm | 18 |
2 files changed, 32 insertions, 20 deletions
diff --git a/Makefile.PL b/Makefile.PL index a77ed16..a5a4d56 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -12,23 +12,23 @@ WriteMakefile( : () ), PL_FILES => {}, PREREQ_PM => { - 'Test::More' => 0, - 'YAML' => 0, - 'Dancer' => 1.3051, - 'Plack' => 0.9974, - 'MongoDB' => 0.43, - 'Template' => 0, - 'Moose' => 2.0007, - 'MooseX::App::Cmd' => 0.06, - 'Try::Tiny' => 0.09, - 'JSON' => 2.53, - 'DateTime' => 0.70, - 'MooseX::ConfigFromFile' => 0.03, - 'Log::Dispatchouli' => 2.005, - 'Net::HTTP::Spore' => 0, - 'Cache::Memcached' => 0, - 'Plack::Middleware::ETag' => 0.03, - 'MooseX::Role::Parameterized' => 0, + 'Test::More' => 0, + 'YAML' => 0, + 'Dancer' => 1.3051, + 'Plack' => 0.9974, + 'MongoDB' => 0.43, + 'Template' => 0, + 'Moose' => 2.0007, + 'MooseX::App::Cmd' => 0.06, + 'Try::Tiny' => 0.09, + 'JSON' => 2.53, + 'DateTime' => 0.70, + 'MooseX::ConfigFromFile' => 0.03, + 'Log::Dispatchouli' => 2.005, + 'Net::HTTP::Spore' => 0, + 'Dancer::Plugin::Memcached' => 0, + 'Plack::Middleware::ETag' => 0.03, + 'MooseX::Role::Parameterized' => 0, 'Moose::Meta::Attribute::Custom::Trait::Chained' => 0, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, diff --git a/lib/StarGit.pm b/lib/StarGit.pm index 2895992..1490e77 100644 --- a/lib/StarGit.pm +++ b/lib/StarGit.pm @@ -2,7 +2,7 @@ package StarGit; use Dancer ':syntax'; use StarGit::Graph; -use Cache::Memcached; # don't use it yet +use Dancer::Plugin::Memcached; our $VERSION = '0.1'; @@ -24,7 +24,9 @@ get '/graph/local/:name' => sub { $graph->neighbors( $name, 1 ); $graph->remove_leaves(); - return _finalize($graph); + my $serialized_graph = _finalize($graph); + memcached_store($name, $serialized_graph); + return $serialized_graph; }; # XXX do we already use this one ? @@ -34,7 +36,8 @@ get '/graph/query' => sub { my $graph = StarGit::Graph->new( language => $language ); $graph->build_from_query(); - return _finalize($graph); + my $serialized_graph = _finalize($graph); + return $serialized_graph; }; get '/graph/attributes' => sub { @@ -43,6 +46,15 @@ get '/graph/attributes' => sub { return { attributes => $attributes }; }; +get '/profile/:login' => sub { + my $login = params->{login}; + my $info = StarGit::Info->new( login => $login ); + if ( !defined $info ) { + return send_error( "no information for profile " . $login ); + } + return $info; +}; + sub _finalize { my $graph = shift; |
