# in MyApp.pm __PACKAGE__->config( "Plugin::Cache" => { backend => { class => "Cache::MemoryCache", } }); # in MyApp::Controller::Root sub counter :Local Args(0) { my ( $self, $c ) = @_; my $counter = $c->cache->get("counter") + 1; $c->cache->set( counter => $counter ); $c->response->body("Count #" . $counter); }