Comparing WinCache user cache APIs with other caches
WinCache 1.1 beta release added two new major features to WinCache. These are user cache APIs which can be used to store custom data in the cache and “wincache” session handler. User cache APIs was the biggest feature gap WinCache 1.0 had compared to other caching solutions which are frequently used on Linux. WinCache 1.1 release was aimed to fill this gap. WinCache session handler, which internally uses user cache, is included so that php session data can be stored in in-memory shared cache instead of on disk which tend to be slower. Read more about these features here.
Both the features are very well received by customers and many open source application developers are working to include support for these in the applications. If you want to use WinCache user cache APIs to speed up your php application, it will be useful to first look for code which is doing that with other caches like APC, Xcache and Eaccelerator. If the application is written to make use of a caching solution, chances are that there will be plug-in available for APC or Xcache or Eaccelerator. Once you have the code you can use the following table to easily map API calls to other caches to WinCache.
WINCACHE |
APC |
XCACHE |
EACCELERATOR |
wincache_ucache_get |
apc_fetch |
xcache_get |
eaccelerator_get |
wincache_ucache_set |
apc_store |
xcache_set |
eaccelerator_put |
wincache_ucache_add |
apc_add |
NONE |
NONE |
wincache_ucache_exists |
NONE |
xcache_isset |
NONE |
wincache_ucache_delete |
apc_delete |
xcache_unset |
eaccelerator_rm |
wincache_ucache_clear |
apc_clear_cache |
xcache_clear_cache |
eaccelerator_clear |
wincache_ucache_inc |
apc_inc |
xcache_inc |
NONE |
wincache_ucache_dec |
apc_dec |
xcache_dec |
NONE |
wincache_ucache_cas |
apc_cas |
NONE |
NONE |
wincache_ucache_info |
apc_sma_info |
xcache_info |
eaccelerator_list_keys |
Other than unset_by_prefix functionality in Xcache, WinCache provides a superset of the functionality offered by other caching solutions. Another piece missing in WinCache is APIs similar to eaccelerator_lock and eaccelerator_unlock. We are trying to understand scenarios in which these APIs will be required by developers while working with user cache APIs. If we see these are required, we will add these in future. I hope this table makes it easy to use WinCache user cache APIs and port code written for existing caches.