diff --git a/reference/wincache/book.xml b/reference/wincache/book.xml index f187882e67..8dd5944e9d 100644 --- a/reference/wincache/book.xml +++ b/reference/wincache/book.xml @@ -15,7 +15,7 @@ functionality without any code modifications. - The Windows Cache Extension includes 3 different types of caches. The following describes + The Windows Cache Extension includes 5 different types of caches. The following describes the purpose of each cache type and the benefits it provides. @@ -33,7 +33,7 @@ - File Cache - Even with the PHP bytecode cache enabled, the PHP engine + File Cache - Even with the PHP opcode cache enabled, the PHP engine has to accesses the script files on a file system. When PHP scripts are stored on a remote UNC file share, the file operations introduce a significant performance overhead. The Windows Cache Extension for PHP includes a file cache that is used to store the content @@ -53,6 +53,21 @@ PHP engine has to perform. + + + User Cache (available since version 1.1.0) - PHP scripts can take advantage of + the shared memory cache by using the user cache API's. PHP objects and variables can be stored in the + user cache and then re-used on subsequent requests. This can be used to improve performance of PHP scripts + and to share the data across multiple PHP processes. + + + + + Session Handler (available since version 1.1.0) - The WinCache session handler can be used to + store the PHP session data in the shared memory cache. This avoids file system operations for reading + and writing session data, which improves performance when large amound of data is stored in PHP session. + + diff --git a/reference/wincache/functions/wincache-fcache-fileinfo.xml b/reference/wincache/functions/wincache-fcache-fileinfo.xml index 95c063bf60..56774de1a7 100644 --- a/reference/wincache/functions/wincache-fcache-fileinfo.xml +++ b/reference/wincache/functions/wincache-fcache-fileinfo.xml @@ -138,6 +138,8 @@ Array wincache_rplist_fileinfo wincache_rplist_meminfo wincache_refresh_if_changed + wincache_ucache_meminfo + wincache_ucache_info diff --git a/reference/wincache/functions/wincache-fcache-meminfo.xml b/reference/wincache/functions/wincache-fcache-meminfo.xml index 303003401d..236ce90390 100644 --- a/reference/wincache/functions/wincache-fcache-meminfo.xml +++ b/reference/wincache/functions/wincache-fcache-meminfo.xml @@ -96,6 +96,8 @@ Array wincache_rplist_fileinfo wincache_rplist_meminfo wincache_refresh_if_changed + wincache_ucache_meminfo + wincache_ucache_info diff --git a/reference/wincache/functions/wincache-ocache-fileinfo.xml b/reference/wincache/functions/wincache-ocache-fileinfo.xml index 84eef7db9e..ee2e0e7223 100644 --- a/reference/wincache/functions/wincache-ocache-fileinfo.xml +++ b/reference/wincache/functions/wincache-ocache-fileinfo.xml @@ -151,6 +151,8 @@ Array wincache_rplist_fileinfo wincache_rplist_meminfo wincache_refresh_if_changed + wincache_ucache_meminfo + wincache_ucache_info diff --git a/reference/wincache/functions/wincache-ocache-meminfo.xml b/reference/wincache/functions/wincache-ocache-meminfo.xml index 77c9498341..e64be23afe 100644 --- a/reference/wincache/functions/wincache-ocache-meminfo.xml +++ b/reference/wincache/functions/wincache-ocache-meminfo.xml @@ -96,6 +96,8 @@ Array wincache_rplist_fileinfo wincache_rplist_meminfo wincache_refresh_if_changed + wincache_ucache_meminfo + wincache_ucache_info diff --git a/reference/wincache/functions/wincache-refresh-if-changed.xml b/reference/wincache/functions/wincache-refresh-if-changed.xml index 3cc4378ee8..5f95e35d9e 100644 --- a/reference/wincache/functions/wincache-refresh-if-changed.xml +++ b/reference/wincache/functions/wincache-refresh-if-changed.xml @@ -81,6 +81,8 @@ wincache_refresh_if_changed(array($filename)); wincache_ocache_meminfo wincache_rplist_fileinfo wincache_rplist_meminfo + wincache_ucache_meminfo + wincache_ucache_info diff --git a/reference/wincache/functions/wincache-rplist-fileinfo.xml b/reference/wincache/functions/wincache-rplist-fileinfo.xml index f549be353f..8566762c5e 100644 --- a/reference/wincache/functions/wincache-rplist-fileinfo.xml +++ b/reference/wincache/functions/wincache-rplist-fileinfo.xml @@ -101,6 +101,8 @@ Array wincache_ocache_meminfo wincache_rplist_meminfo wincache_refresh_if_changed + wincache_ucache_meminfo + wincache_ucache_info diff --git a/reference/wincache/functions/wincache-rplist-meminfo.xml b/reference/wincache/functions/wincache-rplist-meminfo.xml index 7d180b7522..0cc1ed841f 100644 --- a/reference/wincache/functions/wincache-rplist-meminfo.xml +++ b/reference/wincache/functions/wincache-rplist-meminfo.xml @@ -96,6 +96,8 @@ Array wincache_ocache_meminfo wincache_rplist_fileinfo wincache_refresh_if_changed + wincache_ucache_meminfo + wincache_ucache_info diff --git a/reference/wincache/functions/wincache-ucache-add.xml b/reference/wincache/functions/wincache-ucache-add.xml index 3cce2bf6ae..cf8ab8214b 100644 --- a/reference/wincache/functions/wincache-ucache-add.xml +++ b/reference/wincache/functions/wincache-ucache-add.xml @@ -30,7 +30,7 @@ Store the variable using this key name. If a variable with same key is already present the function - will fail and return false. key is case sensitive. To override the value even if + will fail and return FALSE. key is case sensitive. To override the value even if key is present use wincache_ucache_set function instad. key can also take array of name => value pairs where names will be used as keys. This can be used to add multiple values in the cache in one operation, thus avoiding race condition. @@ -118,7 +118,7 @@ string(3) "BAR" "5", 'Blue' => "6", 'yellow' => "7", 'cyan' => "8"); +$colors_array = array('green' => '5', 'Blue' => '6', 'yellow' => '7', 'cyan' => '8'); var_dump(wincache_ucache_add($colors_array)); var_dump(wincache_ucache_add($colors_array)); var_dump(wincache_ucache_get('Blue')); @@ -146,6 +146,8 @@ string(1) "6" wincache_ucache_delete wincache_ucache_clear wincache_ucache_exists + wincache_ucache_meminfo + wincache_ucache_info diff --git a/reference/wincache/functions/wincache-ucache-clear.xml b/reference/wincache/functions/wincache-ucache-clear.xml index aaae7f93fc..9cc4f25233 100644 --- a/reference/wincache/functions/wincache-ucache-clear.xml +++ b/reference/wincache/functions/wincache-ucache-clear.xml @@ -68,6 +68,8 @@ bool(false) wincache_ucache_delete wincache_ucache_get wincache_ucache_exists + wincache_ucache_meminfo + wincache_ucache_info diff --git a/reference/wincache/functions/wincache-ucache-delete.xml b/reference/wincache/functions/wincache-ucache-delete.xml index a395c5d587..fcbf516e2c 100644 --- a/reference/wincache/functions/wincache-ucache-delete.xml +++ b/reference/wincache/functions/wincache-ucache-delete.xml @@ -124,6 +124,8 @@ array(2) { [0]=> string(6) "yellow" wincache_ucache_get wincache_ucache_clear wincache_ucache_exists + wincache_ucache_meminfo + wincache_ucache_info diff --git a/reference/wincache/functions/wincache-ucache-exists.xml b/reference/wincache/functions/wincache-ucache-exists.xml index 9a37bda4e8..e5019a5b7c 100644 --- a/reference/wincache/functions/wincache-ucache-exists.xml +++ b/reference/wincache/functions/wincache-ucache-exists.xml @@ -72,6 +72,8 @@ bool(true) wincache_ucache_get wincache_ucache_clear wincache_ucache_delete + wincache_ucache_meminfo + wincache_ucache_info diff --git a/reference/wincache/functions/wincache-ucache-get.xml b/reference/wincache/functions/wincache-ucache-get.xml index 2cb4d75138..73155ed07e 100644 --- a/reference/wincache/functions/wincache-ucache-get.xml +++ b/reference/wincache/functions/wincache-ucache-get.xml @@ -119,6 +119,8 @@ bool(true) wincache_ucache_delete wincache_ucache_clear wincache_ucache_exists + wincache_ucache_meminfo + wincache_ucache_info diff --git a/reference/wincache/functions/wincache-ucache-info.xml b/reference/wincache/functions/wincache-ucache-info.xml new file mode 100644 index 0000000000..d68c510dc1 --- /dev/null +++ b/reference/wincache/functions/wincache-ucache-info.xml @@ -0,0 +1,177 @@ + + + + + wincache_ucache_info + + Retrieves information about data stored in the user cache + + + + &reftitle.description; + + boolwincache_ucache_info + + + + Retrieves information about data stored in the user cache. + + + + &reftitle.returnvalues; + + Array of meta data about user cache &return.falseforfailure; + + + The array returned by this function contains the following elements: + + + + total_cache_uptime - total time in seconds that the user cache has been active + + + + + total_item_count - total number of elements that are currently in the user cache + + + + + total_hit_count - number of times the data has been served from the cache + + + + + total_miss_count - number of times the data has not been found in the cache + + + + + file_entries - an array that contains the information about all the cached items: + + + + key_name - name of the key which is used to store the data + + + + + value_type - type of value stored by the key + + + + + use_time - time in seconds since the file has been accessed in the opcode cache + + + + + last_check - time in seconds since the file has been checked for modifications + + + + + is_session - indicates if the data is a session variable + + + + + ttl_seconds - time remaining for the data to live in the cache, 0 meaning infinite + + + + + age_seconds - time elapsed from the time data has been added in the cache + + + + + hitcount - number of times data has been served from the cache + + + + + + + + + + &reftitle.examples; + + + Using <function>wincache_ucache_info</function> + + +]]> + + &example.outputs; + + 0 + [is_local_cache] => + [total_item_count] => 1 + [total_hit_count] => 3 + [total_miss_count] => 1 + [ucache_entries] => Array + ( [1] => Array + ( + [key_name] => green + [value_type] => long + [is_session] => 0 + [ttl_seconds] => 0 + [age_seconds] => 0 [hitcount] => 3 + ) + ) +) +]]> + + + + + + + &reftitle.seealso; + + + wincache_fcache_meminfo + wincache_ocache_fileinfo + wincache_ocache_meminfo + wincache_rplist_meminfo + wincache_rplist_fileinfo + wincache_refresh_if_changed + wincache_ucache_meminfo + + + + + + + diff --git a/reference/wincache/functions/wincache-ucache-set.xml b/reference/wincache/functions/wincache-ucache-set.xml index 1b4355d92a..617b8cf449 100644 --- a/reference/wincache/functions/wincache-ucache-set.xml +++ b/reference/wincache/functions/wincache-ucache-set.xml @@ -150,6 +150,8 @@ string(1) "6" wincache_ucache_delete wincache_ucache_clear wincache_ucache_exists + wincache_ucache_meminfo + wincache_ucache_info diff --git a/reference/wincache/functions/wincache_ucache_meminfo.xml b/reference/wincache/functions/wincache_ucache_meminfo.xml new file mode 100644 index 0000000000..5e18ffaca9 --- /dev/null +++ b/reference/wincache/functions/wincache_ucache_meminfo.xml @@ -0,0 +1,125 @@ + + + + + wincache_ucache_meminfo + + Retrieves information about user cache memory usage + + + + &reftitle.description; + + arraywincache_ucache_meminfo + + + + Retrieves information about memory usage by user cache. + + + + &reftitle.returnvalues; + + Array of meta data about user cache memory usage &return.falseforfailure; + + + The array returned by this function contains the following elements: + + + + memory_total - amount of memory in bytes allocated for the user cache + + + + + memory_free - amount of free memory in bytes available for the user cache + + + + + num_used_blks - number of memory blocks used by the user cache + + + + + num_free_blks - number of free memory blocks available for the user cache + + + + + memory_overhead - amount of memory in bytes used for the user cache internal structures + + + + + + + + &reftitle.examples; + + + A <function>wincache_ucache_meminfo</function> example + + + + + +]]> + + &example.outputs; + + 5242880 + [memory_free] => 5215056 + [num_used_blks] => 6 + [num_free_blks] => 3 + [memory_overhead] => 176 +) +]]> + + + + + + + &reftitle.seealso; + + + wincache_fcache_fileinfo + wincache_fcache_meminfo + wincache_ocache_fileinfo + wincache_rplist_fileinfo + wincache_rplist_meminfo + wincache_refresh_if_changed + wincache_ucache_info + + + + + + + \ No newline at end of file diff --git a/reference/wincache/ini.xml b/reference/wincache/ini.xml index 54beb6163f..78078b173e 100644 --- a/reference/wincache/ini.xml +++ b/reference/wincache/ini.xml @@ -126,6 +126,22 @@ PHP_INI_SYSTEM Available since WinCache 1.0.0 + + wincache.ucenabled + 1 + 0 + 1 + PHP_INI_SYSTEM + Available since WinCache 1.1.0 + + + wincache.ucachesize + 8 + 5 + 85 + PHP_INI_SYSTEM + Available since WinCache 1.1.0 + @@ -316,6 +332,30 @@ wincache.ignorelist = "index.php|misc.php|admin.php" + + + wincache.ucenabled + boolean + + + + Enables or disables the user cache functionality. + + + + + + wincache.ucachesize + integer + + + + Defines the maximum memory size in megabytes that is allocated for the user cache. If the total + size of variables stored in the user cache exceeds the specified value, then the most stale variables + will be removed from the cache. + + + diff --git a/reference/wincache/setup.xml b/reference/wincache/setup.xml index 1c73777bdb..5240286fd0 100644 --- a/reference/wincache/setup.xml +++ b/reference/wincache/setup.xml @@ -184,6 +184,33 @@ $user_allowed = array('DOMAIN\user1', 'DOMAIN\user2', 'DOMAIN\user3'); + +
+ WinCache Session Handler + + The WinCache session handler (available since WinCache 1.1.0) can be used to configure PHP to store the session data in shared memory user cache. + Using shared memory instead of the default file session storage helps improve performance of PHP applications + that store large amount of data in session objects. + + + To configure PHP to use WinCache session handler set the php.ini setting + session.save_handler to wincache. + + Enabling WinCache session handler + + + + + + + In beta release of WinCache Extension 1.1, the user cache is kept in memory and is not backed by a + file system storage. This means that the session data stored in the shared memory will be lost when + IIS application pool is recycled. + + +
&reftitle.resources; diff --git a/reference/wincache/versions.xml b/reference/wincache/versions.xml index 55590a5c3d..b6f246b409 100644 --- a/reference/wincache/versions.xml +++ b/reference/wincache/versions.xml @@ -20,6 +20,8 @@ + +