Name : perl-Plack-Middleware-Cached
| |
Version : 0.15
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp154.1.1
| Date : 2023-01-27 17:59:38
|
Group : Development/Libraries/Perl
| Source RPM : perl-Plack-Middleware-Cached-0.15-lp154.1.1.src.rpm
|
Size : 0.03 MB
| |
Packager : https://www_suse_com/
| |
Summary : Glues a cache to your PSGI application
|
Description :
This module can be used to glue a cache to a the PSGI manpage applications or middleware. A *cache* is an object that provides at least two methods to get and set data, based on a key. Existing cache modules on CPAN include the CHI manpage, the Cache manpage, and the Cache::Cache manpage. Although this module aims at caching PSGI applications, you can use it to cache any function that returns some response object based on a request environment.
Plack::Middleware::Cached is put in front of a PSGI application as middleware. Given a request in form of a PSGI environment E, it either returns the matching response R from its cache, or it passed the request to the wrapped application, and stores the application\'s response in the cache:
________ _____ Request ===E===>| |---E--->| | | Cached | | App | Response < ==R====|________|< --R----|_____|
In most cases, only a part of the environment E is relevant to the request. This relevant part is called the caching *key*. By default, the key is set to the value of REQUEST_URI from the environment E.
Some application may also modify the environment E:
________ _____ Request ===E===>| |---E--->| | | Cached | | App | Response < ==R+E==|________|< --R+E--|_____|
If needed, you can configure Plack::Middleware::Cached with *env* to also cache parts of the environment E, as it was returned by the application.
If Plack::Middleware::Cached retrieved a response from the cache, it sets the environment variable \'plack.middleware.cached\'. You can inspect whether a response came from the cache or from the wrapped application like this:
builder { enable sub { my $app = shift; sub { my $env = shift; my $res = $app->($env); if ($env->{\'plack.middleware.cached\') { ... } return $res; }; }; enable \'Cached\', cache => $cache; $app; },
Caching delayed/streaming responses is supported as well.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-P/15.4/noarch |