micheh / psr7-cache Goto Github PK
View Code? Open in Web Editor NEWCache and conditional request helpers for PSR-7 HTTP Messages
License: BSD 3-Clause "New" or "Revised" License
Cache and conditional request helpers for PSR-7 HTTP Messages
License: BSD 3-Clause "New" or "Revised" License
This library works like a charm but there was an issue that kept me hitting a wall. It'd be nice if it was mentioned somewhere in the README file.
PHP session handler generates its own headers. The exact ones depend on the session.cache_limiter
directive. Its default value is nocache
and that means you get:
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
This interferes completely with \Micheh\Cache\CacheUtil::withCache()
. Only Cache-Control
finally gets the value set by this method. It's also not obvious at first sight because these extra headers are set by PHP core and are invisible for PSR-7 implementations (at least the one I'm using).
It's not necessarily the library's fault but it can lead you to wonder why it isn't working. If you want to cache responses from session based applications you need to set session.cache_limiter
to something that's not the default, e.g.:
ini_set('session.cache_limiter', 'public');
Reference can be found at session_cache_limiter()
manual page.
Hi, thanks for this library, it is a real time saver. Here is an feature request.
I am using psr7-cache in couple of API projects to provide caching based on ETag
and Last-Modified
headers. I would like to use it also for conditional PUT
, PATCH
and DELETE
methods.
This can be done by adding support for the two currently missing If-Match
and If-Unmodified-Since
headers which are described in RFC7232.
This library looks pretty solid ๐๐
I was wondering how come this isn't at 1.0 yet?
Presumable it's stable? And it appears to be very complete.
The only thing I'd consider changing myself is type-hinting everything for modern PHP - is that something you're interested in?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.