rfc:streams-is-cacheable

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:streams-is-cacheable [2015/01/04 01:39] – fixed bullet ajfrfc:streams-is-cacheable [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== PHP RFC: Add is_cacheable() stream-wrapper operation ====== ====== PHP RFC: Add is_cacheable() stream-wrapper operation ======
-  * Version: 1.0 +  * Version: 1.2 
-  * Date: 2015-01-04 (Happy new year !)+  * Date: 2015-01-04
   * Author: François Laupretre, francois@tekwire.net   * Author: François Laupretre, francois@tekwire.net
   * Status: Under discussion   * Status: Under discussion
Line 25: Line 25:
 instance, opcache instance, opcache
 is using the second solution : 'file' and 'phar' are explicitely is using the second solution : 'file' and 'phar' are explicitely
-declared as the only 'cacheable' stream wrappers. This is nothing more than +declared as the only 'cacheable' stream wrappers. This is a 
-quick-and-dirty workaround and we now +quick-and-dirty workaround and there is real need for a reliable and generic 
-need a reliable and generic way of determining whether an URI is cacheable.+way of determining whether an URI is cacheable.
  
 What I am proposing : What I am proposing :
  
-  * An element named 'stream_is_cacheable' is added at the end of the php_stream_wrapper_ops+* An element named 'stream_is_cacheable' is added at the end of the php_stream_wrapper_ops
 structure. This is an optional pointer to a function able to determine if structure. This is an optional pointer to a function able to determine if
 a given URI is cacheable or not. This function receives an URI, an options a given URI is cacheable or not. This function receives an URI, an options
Line 38: Line 38:
 are considered as non-cacheable. are considered as non-cacheable.
  
-  * A new C function named php_stream_is_cacheable(const char *path, int options, php_stream_context *context)+* A new C function named php_stream_is_cacheable(const char *path, int options, php_stream_context *context)
 is defined. It determines the right wrapper from the path it receives and is defined. It determines the right wrapper from the path it receives and
 forwards the request to the corresponding stream_is_cacheable() function, if it forwards the request to the corresponding stream_is_cacheable() function, if it
 exists. If the stream_is_cacheable() element is not defined, 0 is returned. exists. If the stream_is_cacheable() element is not defined, 0 is returned.
  
-  * Userspace stream wrappers can define a method named is_cacheable(path [,options]).+* Userspace stream wrappers can define a method named is_cacheable(path [,options]).
 This method determines if the input path is cacheable and returns true or false. This method determines if the input path is cacheable and returns true or false.
 If the method is not defined, every path for this wrapper are non-cacheable. If the method is not defined, every path for this wrapper are non-cacheable.
  
-  * For completeness, a new PHP function named file_is_cacheable(path [, options [, context]])+* For completeness, a new PHP function named file_is_cacheable(path [, options [, context]])
 is defined. It allows to determine from a PHP script whether a path is cacheable. is defined. It allows to determine from a PHP script whether a path is cacheable.
  
Line 56: Line 56:
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
  
-5.7, if released. Otherwise, PHP 7.+PHP 7.
  
 ===== RFC Impact ===== ===== RFC Impact =====
Line 65: Line 65:
 ==== To Existing Extensions ==== ==== To Existing Extensions ====
  
-Phar needs to implement an is_cacheable() function. This function always returns 1.+Phar needs to implement an is_cacheable() function, returning always 1.
  
 The same for the plain files wrapper. The same for the plain files wrapper.
Line 71: Line 71:
 ==== To Opcache ==== ==== To Opcache ====
  
-Opcode caches will implement the following logic :+Opcode caches must implement the following logic :
  
 If the received path is a 'stream' path, call php_stream_is_cacheable(path, 0, NULL). If the received path is a 'stream' path, call php_stream_is_cacheable(path, 0, NULL).
Line 79: Line 79:
 ==== New Constants ==== ==== New Constants ====
  
-The C-level PHP_STREAMS_SUPPORT_IS_CACHEABLE is defined. This allows conditional +None
-code using '#ifdef' stanza.+
  
 ===== Open Issues ===== ===== Open Issues =====
  
-None+Discussion is under way to define how the cache can compute the key 
 +corresponding to a stream-wrapped path.
  
 ===== Unaffected PHP Functionality ===== ===== Unaffected PHP Functionality =====
Line 93: Line 93:
 ===== Proposed Voting Choices ===== ===== Proposed Voting Choices =====
  
-2/3 or 50%+1 majority ? Not clear for me :)+Required majority: 50%+1
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
  
-A pull request is available at : +Pull Request: [[https://github.com/php/php-src/pull/976]]
- +
-[[https://github.com/php/php-src/pull/976]]+
  
-This patch includes every modification described in this RFC, including phar and+This PR includes every modification described in this RFC, including phar and
 plain files is_cacheable() handler. It also contains tests. plain files is_cacheable() handler. It also contains tests.
  
-PHP manual changes not written yet.+PHP documentation additions (file_is_cacheable(), streamWrapper::is_cacheable()) 
 +not written yet.
  
 ===== Implementation ===== ===== Implementation =====
rfc/streams-is-cacheable.1420335588.txt.gz · Last modified: 2017/09/22 13:28 (external edit)