. SQLite3 , igbinary APCu php . , .
?
, MariaDB MySQL . . . . .
?
PHP SQLite3 igbinary , . APCu , .
redis . redis . Redis Object Cache . redis SQL SQL redis . memcached , Memcached Object Cache . LiteSpeed Cache .
- . SQLite .
- APCu SQLite . -.
APCu
APCu . PHP . APCu APCu . SQLite 5 1 , SQLite . .
WP-CLI: APCu WP-CLI WP-CLI APCu SQLite . APCu SQLite .
WP-CLI
WP-CLI . .
wp help sqlite-object-cache
: Till Krss. Redis Object Cache . Ari Stathopoulos Jonny Harris . Matt Jones . Massimo Villa nickchomey . .
JetBrains , PhpStorm . PhpStorm .
?
PHP SQLite3 .
SQLite Object Cache” “ > ” “SQLite Object Cache” , :
- WordPress.org
- ‘ > > ’ ZIP .
- ‘’ .
, WP-CLI , , , 32MiB .
wp plugin install sqlite-object-cache
wp config set WP_CACHE_KEY_SALT $(openssl rand -base64 12)
wp plugin activate sqlite-object-cache
wp sqlite-object-cache size 32
wp-config.php . . , .
- WP_SQLITE_OBJECT_CACHE_SERIALIZE. true SQLite ‘s serialize() . , igbinary .
- WP_SQLITE_OBJECT_CACHE_DB_FILE. SQLite .
/wp-content/.ht.object_cache.sqlite. SQLite . - WP_SQLITE_OBJECT_CACHE_TIMEOUT. SQLite . : 5000. ( .)
- WP_SQLITE_OBJECT_CACHE_JOURNAL_MODE. SQLite . : WAL. : DELETE | TRUNCATE | PERSIST | MEMORY | WAL | WAL2 | NONE. ( SQLite3 WAL2 .)
- WP_SQLITE_OBJECT_CACHE_APCU. true APCu RAM . .
- WP_SQLITE_OBJECT_CACHE_CHECKPOINT_FREQ. How often, probabilistically, to force checkpointing SQLite3. Make this number smaller on busy sites if your WAL file gets too long. Default 2000.
- WP_CACHE_KEY_SALT. Set this to a hard-to-guess random value to make your cache keys harder to guess. This setting works for other cache plugins as well.
. WP_CACHE_KEY_SALT . . WP_CACHE_KEY_SALT wp-config.php .
wp-config.php .
define( 'WP_CACHE_KEY_SALT', 'Random_t6xJix' );
. Linux openssl rand -base64 12 . WP-CLI .
wp config set WP_CACHE_KEY_SALT $(openssl rand -base64 12)
APCu
APCu . APCu . . . wp-config.php WP_SQLITE_OBJECT_CACHE_APCU true . WP-CLI .
wp config set --raw WP_SQLITE_OBJECT_CACHE_APCU true
wp-config.php .
define( 'WP_SQLITE_OBJECT_CACHE_APCU', true );
FAQ
-
?
-
. > .
-
?
-
?
-
16(MiB). , . . .
32 MiB .
. , . SQLite .
-
SQLite ?
-
igbinary ?
-
igbinary php . php serializer . php igbinary ,
wp-config.phpWP_SQLITE_OBJECT_CACHE_SERIALIZEtrue. -
APCu ?
-
APCu PHP . .
-
APCu 32MiB.
php.iniapc.shm_size .apc.shm_size = 64M64MiB . .APCu . APCu .
-
MariaDB MySQL SQLite ?
-
. MariaDB MySQL sql . , , . SQLite . “|3″ 3 . SQLite .
-
, ? SQL ?
-
, . SQLite .
. SQLite / .
redis . Redis Object Cache . redis SQL SQL redis . memcached , Memcached Object Cache .
redis memcached SQLite . . .
-
?
-
. . Redis Memcached . , .
(persistent object caching) . Drop-in . “object-cache.php” (drop-in) . .
WP Rocket, LiteSpeed Cache, WP Total Cache, WP Super Cache, WP Fastest Cache . Cloudflare . . ( !)
-
REST API ?
-
. . .
The object cache contents are organized by group. For example, it caches data from your
wp_postmetatable in the cache group called'post_meta'. You can disable caching for particular groups withwp_cache_add_non_persistent_groups(). Some plugins need to use this feature. -
MySQL MariaDB ?
-
. .
-
Redis memcached ?
-
. , . .
-
HDD/SSD , redis memcached RAM . RAM ?
-
RAM is indeed faster. Modern server operating systems offer extensive page caching in RAM for files, and SQLite is designed to take advantage of that, so the data needed may already be in RAM. Using a separate cache server require the web server to issue network requests and wait for responses, whereas using SQLite does not.
-
MariaDB MySql ?
-
, . . PHP , SQLite . .
-
SQLite ?
-
. . .
SQLite
*.sqlite,*.sqlite-wal,*.sqlite-wal2,*.sqlite-shm.Updraft Plus, BackWPUp, WP STAGING SQLite . Duplicator .
-
?
-
No. You only need one persistent object cache plugin, and WordPress only supports one at a time.
-
, ?
-
. . Redis . ( , .)
-
No, probably not. SQLite does not work correctly if you put its files on a shared network drive (via CIFS, SMB, NFS, or some other drive sharing protocol). Please read this for a more complete explanation. If your host operating system provides a local directly-connected drive for a temporary file system, you can try to put your .sqlite files there. Please read this.
-
Performance Lab ?
-
, Performance Lab . Performance Lab .
Performance Lab . . .
-
?
-
. . Transient API , MariaDB MySQL . Metadata API Options API .
-
?
-
WP_Cache WordPress .
.../wp-content/object-cache.php. . -
?
-
wp_content.ht.object-cache.sqlite..ht.. SQLite.ht.object-cache.sqlite-shm.ht.object-cache.sqlite-wal.wp-config.phpWP_SQLITE_OBJECT_CACHE_DB_FILE.Linux UNIX (.)
ls -a. -
. ?
-
.sqlite . .
WP_SQLITE_OBJECT_CACHE_DB_FILEwp_config.phpsqlite .wp-config.phpdefine( 'WP_SQLITE_OBJECT_CACHE_DB_FILE', '/tmp/mysite-object-cache.sqlite' );/tmpmysite-object-cache.sqlite.WP_CACHE_KEY_SALT. ,define( 'WP_CACHE_KEY_SALT', 'qrstuv' );/tmpmysite-object-cache.qrstuv.sqlite. -
SQLite I/O ?
-
. SQLite - I/O . PHP . . MiB . , wp-config 32MiB .
define( 'WP_SQLITE_OBJECT_CACHE_MMAP_SIZE', 32 );I/O . . APCu .
-
SQLite . ?
-
:
Unable to execute statement: database is locked in /var/www/wp-content/object-cache.php:1234(, ) . . . .
. .
wp-config.phpWP_SQLITE_OBJECT_CACHE_TIMEOUT5000 . -
WP-CLI ?
-
WP-CLI . - . - wp-cli . .
On Linux, you can run your WP-CLI shell commands like this:
sudo -u www-data wp config listThis ensures they run with the same user as the web server. Please notice that versions 1.6.4 and later of the plugin contains a fix to reduce the chance of this problem affecting you. -
IIS Microsoft Windows ?
-
. APCu (corruption) . PHP DLL ‘ (non thread safe)’ .
-
I’m having trouble deactivating the plugin.
-
Try deleting the plugin directory
.../wp-content/plugins/sqlite-object-cache, and then deleting the drop-in file from.../wp-content/object-cache.php. -
. ?
-
?
-
Q: ?
- .
- .
, . .
-
&
1.6.5
- Support plugins that use set_transient or other cache operations in their destructors.
1.6.4
- Set the permissions of SQLite’s files (including the -wal and -shm files) to group-writeable to make WL-CLI more convenient.
- Handle incrementing and decrementing expiring cache entries correctly, and handle expiration around runtime flush correctly.
- Selectively flush the APCu cache upon wp_flush_cache_group.
- Improve the cache key display on the statistics tab.
1.6.3
A race condition caused expired cache entries to be copied to APCu incorrectly sometimes. This is corrected. Props to @pobrehablador for finding this defect.
1.6.2
- Use PRAGMA wal_checkpoint(TRUNCATE) sometimes to avoid excessively large re-used WAL files.
- Checkpoint more frequently.
- Health check for OPcache (not APCu) saturation.
1.6.1
- Add an optional Flush Object Cache button to the admin bar. Props to Nick Chomey.
- Fix a defect in testing for writability of the .sqlite files. Props to @powerkiki: Adrien Crivelli.
1.6.0
- : .