Re: [PHP-DEV] [RFC][VOTE] Add support for stream-wrapped URLs inopcode cache

2017-06-20 Thread François Laupretre

Hi,

Le 20/06/2017 à 18:35, 江湖大虾仁 a écrit :

Hi François,
  Good work, but I'm not sure if I missed something because I didn't 
find any discuss relating to this RFC in my mail box, as well as the 
PR on GitHub. I have a question about the detail of `cache_key`:


Discussion : http://www.serverphorums.com/read.php?7,1505444

> If the method is not defined, every path associated to this wrapper 
are non-cacheable. In order to avoid key value conflicts, the returned 
key must start with the same '://' prefix as the input path. 
If it not the case, an error is raised and the key is ignored.


Why don't we simply ask `cache_key` to provide the path, and we 
combine it with scheme in the core? It's much easier for userland to 
implement this feature since there is less limits, and we didn't need 
to worry about the key conflicts between different stream-wrappers any 
more.


1. The userspace code needs to get the full URL as input, as a stream 
wrapper may be associated with more than one scheme.
2. In the most usual case where the input URL is to be used as key, I 
cannot ask developers to compute the returned path by removing the 
'://' prefix from the input URL. The API is much easier to 
understand if they just return the input URL. It is also faster in this 
case because the PHP function/method returning its input argument won't 
even duplicate the data (it will just increment the zend_string 
reference count).


Regards

François

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [RFC][VOTE] Add support for stream-wrapped URLs inopcode cache

2017-06-20 Thread 江湖大虾仁
Hi François,
  Good work, but I'm not sure if I missed something because I didn't find any 
discuss relating to this RFC in my mail box, as well as the PR on GitHub. I 
have a question about the detail of `cache_key`:


> If the method is not defined, every path associated to this wrapper are  
> non-cacheable. In order to avoid key value conflicts, the returned key  must 
> start with the same '://' prefix as the input path.  If it not the 
> case, an error is raised and the key is ignored.


Why don't we simply ask `cache_key` to provide the path, and we combine it with 
scheme in the core? It's much easier for userland to implement this feature 
since there is less limits, and we didn't need to worry about the key conflicts 
between different stream-wrappers any more.




best regards,
CHU Zhaowei


-- Original --
From:  "François Laupretre"<franc...@tekwire.net>;
Date:  Tue, Jun 20, 2017 02:12 AM
To:  "François Laupretre"<franc...@php.net>; 
"Internals"<internals@lists.php.net>; 

Subject:  Re: [PHP-DEV] [RFC][VOTE] Add support for stream-wrapped URLs 
inopcode cache

 
Hi,

Opening vote for : https://wiki.php.net/rfc/url-opcode-cache

Voting period will end Monday, July 3, 2017, 00:00 UTC.

Regards

François

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php