Wordpress Caching | 1412 https://xvlnw.com I'm on my way Tue, 22 Feb 2022 06:34:34 +0000 th hourly 1 https://wordpress.org/?v=5.5.13 Fixed Table of Redis Object Cache & TTL https://xvlnw.com/topic/879 Sun, 20 Feb 2022 16:04:18 +0000 https://xvlnw.com/?p=879 สำหรับปัญหาหนึ่งของการใช้งาน Plugin: Redis Object Cache ของ WordPress หากเราไม่ได้ตั้งค่า prefix tables ของ DB เราจะได้ค่า Default เป็น wp_ แต่มันสร้างปัญหา เมื่อเราติดตั้ง WordPress มากกว่า 2 เว็บ และมี prefix เดียวกัน ตัว Plugin: Redis Object Cache จะใช้ Prefix Key เดียวกัน ทำให้อ่านเขียนแคชมั่วไป…

The post Fixed Table of Redis Object Cache & TTL first appeared on 1412.]]>
สำหรับปัญหาหนึ่งของการใช้งาน Plugin: Redis Object Cache ของ WordPress หากเราไม่ได้ตั้งค่า prefix tables ของ DB เราจะได้ค่า Default เป็น wp_ แต่มันสร้างปัญหา เมื่อเราติดตั้ง WordPress มากกว่า 2 เว็บ และมี prefix เดียวกัน ตัว Plugin: Redis Object Cache จะใช้ Prefix Key เดียวกัน ทำให้อ่านเขียนแคชมั่วไปหมด ปนกันทั้ง 2 เว็บ เราสามารถแก้ไขปัญหานี้ได้ด้วยการเพิ่ม Perfix ของ Redis เข้าไปครับ

# After define( 'DB_COLLATE', '' );
if(!defined('WP_REDIS_PREFIX')){
define('WP_REDIS_PREFIX', substr(md5(DB_NAME), 0, 6) . '_');
define('WP_REDIS_MAXTTL', 86400);
}

และแถมด้วยอีกคำสั่งก็ค่อ MAXTTL ที่ช่วยกำหนดเวลาของแคช จากค่า Default = 3600 เป็น 86400 (หน่วยเป็นวินาที) เพื่อเพิ่มประสิทธิภาพของแคชครับ

The post Fixed Table of Redis Object Cache & TTL first appeared on 1412.]]>
cf-edge-cache: cache,platform=wordpress https://xvlnw.com/topic/781 Tue, 08 Dec 2020 11:20:51 +0000 https://xvlnw.com/?p=781 หลังจากที่เปลี่ยนมาใช้ LiteSpeed Enterprise พบว่าการส่ง Header จาก Cloudflare เปลี่ยนไป การแคชข้อมูลเป็บแบบสำหรับ Cloudflare WordPress Caching โดยเฉพาะเลย เพราะว่าตัว Cloudflare ทำงานร่วมกับ LiteSpeed Enterprise ได้ดีนั่นเอง Header ที่ส่งกลับมา ลองดูว่าต้องมี 3 ค่านี้ส่งกลับมาที่ Client นะครับ วิธีก…

The post cf-edge-cache: cache,platform=wordpress first appeared on 1412.]]>
หลังจากที่เปลี่ยนมาใช้ LiteSpeed Enterprise พบว่าการส่ง Header จาก Cloudflare เปลี่ยนไป การแคชข้อมูลเป็บแบบสำหรับ Cloudflare WordPress Caching โดยเฉพาะเลย เพราะว่าตัว Cloudflare ทำงานร่วมกับ LiteSpeed Enterprise ได้ดีนั่นเอง

Header ที่ส่งกลับมา

cf-edge-cache: cache,platform=wordpress
x-litespeed-cache: hit
cf-cache-status: HIT

ลองดูว่าต้องมี 3 ค่านี้ส่งกลับมาที่ Client นะครับ วิธีการเช็ค Header ง่ายๆ ก็ใช้ Command line : curl

curl -Iv https://cloudhost.in.th

สำหรับการทดสอบกับ OpenLiteSpeed จะไม่พ่น cf-edge-cache ออกมาครับ ซึ่งก็คาดว่าจะรองรับเฉพาะเวอร์ชั่น LiteSpeed Enterprise เท่านั้น

สำหรับใครที่อยากจะเซตแบบนี้ CloudHost.in.th มีบริการเซตให้ฟรี รองรับ 1 Domain เท่านั้น ดูบริการ Cloud Server สำหรับ WordPress Hosting ได้ที่ลิงก์ด้านล่างนี้

The post cf-edge-cache: cache,platform=wordpress first appeared on 1412.]]>