Comments (3)
Hello. What are your use case?
This method is used in Middleware::readResponse()
and Middleware::saveResponse()
.
In saveResponse the page is saved only if no query parameters are in the url (https://github.com/oscarotero/psr7-middlewares/blob/master/src/Middleware/SaveResponse.php#L31)
ReadResponse does not check whether there's query parameters in the url. These two middlewares are designed to create a basic file based cache, for static pages, so query parameters are not covered.
Maybe this the problem?
from psr7-middlewares.
My use case is filtering a timeline, so I have "tabs" of sorts that display different content. I think indeed it's caching the page when there's no query parameter (view all) but then that cache is reused when there are query parameters.
from psr7-middlewares.
To do that, you need to use Cache
, combined with any psr6 compliance library. In the tests I'm using http://www.scrapbook.cash/ that have adapters for many storage systems including filesystem (using flysystem). An example:
// create Flysystem object
$adapter = new \League\Flysystem\Adapter\Local('/path/to/cache', LOCK_EX);
$filesystem = new \League\Flysystem\Filesystem($adapter);
// create Scrapbook cache object
$cache = new \MatthiasMullie\Scrapbook\Adapters\Flysystem($filesystem);
// create a psr6 Pool object from cache engine
$pool = new \MatthiasMullie\Scrapbook\Psr6\Pool($cache);
//middlewares
$dispatcher = $relay->newInstance([
Middleware::cache($pool)
]);
from psr7-middlewares.
Related Issues (20)
- Error handler middleware assumes stream immutability HOT 1
- Does this project follow semver? HOT 2
- HTTPS terminated at load balancer HOT 9
- Custom Middleware HOT 2
- Closed
- Expose Middleware HOT 2
- JSON Schema incompatible with Slim Framework HOT 5
- Defective unit tests not marked as risky. HOT 1
- JsonDecoder HOT 4
- Csrf middleware is not fully PHP 5 compatible HOT 5
- Slim v3 and DigestAuth middleware is endlessly looping the password dialog. HOT 3
- Question about Cache Middleware HOT 3
- AuraRouter curl stuck at 404 not found. HOT 3
- Adding extra slashes after domain name in url allows you to bypass JWT Authentication
- MiddlewareInterface HOT 2
- https middleware HOT 10
- BlockSpam default path to spammers.txt is wrong HOT 1
- FormatNegotiator - hard coded priorities? HOT 4
- apply http-interop/http-middleware compatibiity HOT 6
- Firewall middleware needs ClientIp executed before HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from psr7-middlewares.