4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【WordPress】APCuを使えるようにする

Posted at

APCu Object Cache Backend をダウンロード

APCu Object Cache Backend のURLはこちら
https://ja.wordpress.org/plugins/apcu/

場所はどこれあれ、ZIPをダウンロードして展開できればOK

[root@test-web ~]# cd /tmp
[root@test-web tmp]# wget https://downloads.wordpress.org/plugin/apcu.1.0.2.zip
[root@test-web tmp]# unzip apcu.1.0.2.zip

object-cache.phpをwp-contentに配置

[root@test-web tmp]# cp apcu/object-cache.php /[アプリの場所]/wordpress/wp-content/object-cache.php

"Tribe Object Cache" の必要性について

ソースを見る限り、"Tribe Object Cache"プラグインではobject-cache.phpの配置のみを行っている。
そのため、object-cache.phpさえ然るべき場所に置かれていればプラグインが無くても動作は可能
プラグインの有効/停止でAPCuの動きを制御したい時は入れておいた方が良い。

tribe-object-cache.php
<?php
/*
Plugin Name:    Tribe Object Cache
Description:    Simple plugin that supports Memcached, APC, Xcache or WinCache based on your system. All you have to do is activate it.
Author:                 Peter Chester, Modern Tribe, Inc.
Version:                1.0.4
Author URI:             http://tri.be
*/

// Block direct requests
if ( !defined('ABSPATH') )
        die( 'Sorry Chuck!' );

register_activation_hook( __FILE__, 'add_object_cache_file' );
register_deactivation_hook( __FILE__, 'remove_object_cache_file' );

/**
 * Place the object-cache.php file into wp-contents.
 */
function add_object_cache_file() {
        $from = dirname( __FILE__ ) . '/lib/object-cache.php';
        $to = WP_CONTENT_DIR . '/object-cache.php';
        copy( $from, $to );
}

/**
 * Remove the object-cache.php file from wp-contents.
 */
function remove_object_cache_file() {
        $file = WP_CONTENT_DIR . '/object-cache.php';
        unlink( $file );
}

?>

番外編:apc.phpを使えるようにする

APCないしはAPCuのパフォーマンスを可視化してくれるツールがapc.php

image

ソースの取得

URLはこちら
https://github.com/krakjoe/apcu/

[root@test-web ~]# cd /tmp
[root@test-web tmp]# git clone https://github.com/krakjoe/apcu/
[root@test-web tmp]# cp apc.php /[phpソースの見られるディレクトリ]/apc.php

右側の円グラフ、棒グラフが見えないんですけどー

そういう時はGDライブラリがまだ入っていないのでGDを入れる

[root@test-web ~]# yum install php-gd
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?