当前位置: 首页 > 工具软件 > Turck MMCache > 使用案例 >

Windows下安装Turck MMCache

何越
2023-12-01

1.什么是Turk MMCache

Turck MMCache is a free open source PHP accelerator, optimizer, encoder and dynamic content cache for PHP. It increases performance of PHP scripts by caching them in compiled state, so that the overhead of compiling is almost completely eliminated. Also it uses some optimizations to speed up execution of PHP scripts. Turck MMCache typically reduces server load and increases the speed of your PHP code by 1-10 times.

 

Turck MMCache是一个类似于Zend Optimizer/Encoder的工具,不过速度要超过后者。而且他是一个开源的软件,可以免费使用.它主要应用与加速优化php程序运行效率,编码和动态内容缓存。

 

2.Windows下Turk MMCache安装配置

To build Turck MMCache on Windows platform you will need MS Visual Studio C++ 6.0.

Step 1. Compiling Turck MMCache
- Unpack php sources.
- Put mmcache sources under "ext/mmcache".
- Put "php4ts.lib" into "ext/mmcache".
- Copy "main/config.w32.h.in" into "main/config.w32.h".
- Open project file "ext/mmcache/mmcache.dsp".
- Select release configuration and build "mmcache.dll".

Step 2. Installing Turck MMCache
Copy "mmcache.dll" into your PHP extension folder.

Step 3. Configuring Turck MMCache
Add the following lines into your "php.ini" file (usually "c:/winnt/php.ini")

zend_extension_ts="c:/fullpathtommcache/mmcache.dll"
  mmcache.shm_size="16"
  mmcache.cache_dir="c:/tmp/mmcache"
  mmcache.enable="1"
  mmcache.optimizer="1"
  mmcache.check_mtime="1"
  mmcache.debug="0"
  mmcache.filter=""
  mmcache.shm_max="0"
  mmcache.shm_ttl="0"
  mmcache.shm_prune_period="0"
  mmcache.shm_only="0"
  mmcache.compress="1"

Step 4. Creating cache directory

mkdir c:/tmp/mmcache

Configuration Options

mmcache.shm_size
The amount of shared memory (in megabytes) that Turck MMCache will use. "0" means OS default. Default value is "0".
mmcache.cache_dir
The directory that is used for disk cache. Turck MMCache stores precompiled code, session data, content and user entries here. The same data can be stored in shared memory also (for more quick access). Default value is "/tmp/mmcache".
mmcache.enable
Enables or disables Turck MMCache. Should be "1" for enabling or "0" for disabling. Default value is "1".
mmcache.optimizer
Enables or disables internal peephole optimizer which may speed up code execution. Should be "1" for enabling or "0" for disabling. Default value is "1".
mmcache.debug
Enables or disables debug logging. Should be "1" for enabling or "0" for disabling. Default value is "0".
mmcache.check_mtime
Enables or disables PHP file modification checking. Should be "1" for enabling or "0" for disabling. You should set it to "1" if you want to recompile PHP files after modification. Default value is "1".
mmcache.filter
Determine which PHP files must be cached. You may specify the number of patterns (for example "*.php *.phtml") which specifies to cache or not to cache. If pattern starts with the character "!", it means to ignore files which are matched by the following pattern. Default value is "" that means - all PHP scripts will be cached.
mmcache.shm_max
Disables putting large values into shared memory by "mmcache_put()" function. It indicates the largest allowed size in bytes (10240, 10K, 1M). The "0" disables the limit. Default value is "0".
mmcache.shm_ttl
When MMCache fails to get shared memory for new script it removes all scripts which were not accessed at last "shm_ttl" seconds from shared memory. Default value is "0" that means - don't remove any files from shared memory.
mmcache.shm_prune_period
When MMCache fails to get shared memory for new script it tryes to remove old script if the previous try was made more then "shm_prune_period" seconds ago. Default value is "0" that means - don't try to remove any files from shared memory.
mmcache.shm_only
Enables or disables caching of compiled scripts on disk. It has no effect on session data and content caching. Default value is "0" that means - use disk and shared memory for caching.
mmcache.compress
Enables or disables cached content compression. Default value is "1" that means enable compression.
mmcache.keys
mmcache.sessions
mmcache.content
Determine where keys, session data and content will be cached. The possible values are:
"shm_and_disk" - cache data in shared memory and on disk (default value)
"shm" - cache data in shared memory or on disk if shared memory is full or data size greater then "mmcache.shm_max"
"shm_only" - cache data in shared memory
"disk_only" - cache data on disk
"none" - don't cache data
 类似资料: