Nawawi Jamili
Forum Replies Created
-
Forum: Plugins
In reply to: [Docket Cache - Object Cache Accelerator] GC is not cleaning files and memoryAnd one more thing, I’m not documenting it yet, for some cache groups, if cache expiry is 0 it will set to a specific setting, to reduce disk I/O.
Cache expiry is from WordPress cache function wp_cache_set.
file: includes/cache.php line 665
groups: site-transient, transient
28 days if keys: update_plugins, update_themes, update_core
7 days for other keys.groups: terms, posts, post_meta, options, site-options, comments
14 daysprivate function maybe_expire($group, $expire = 0, $key = '') { if (empty($expire)) { $expire = 0; } $expire = $this->fs()->sanitize_second($expire); $maxttl = $this->cache_maxttl; if (0 === $expire && $maxttl < 2419200) { if (\in_array($group, ['site-transient', 'transient'])) { if ('site-transient' === $group && \in_array($key, ['update_plugins', 'update_themes', 'update_core'])) { $expire = $maxttl < 2419200 ? 2419200 : $maxttl; // 28d } else { $expire = $maxttl < 604800 ? 604800 : $maxttl; // 7d } } elseif (\in_array($group, ['terms', 'posts', 'post_meta', 'options', 'site-options', 'comments'])) { $expire = $maxttl < 1209600 ? 1209600 : $maxttl; // 14d } } return $expire; }
if you do a quick test, just replace with this code:
private function maybe_expire($group, $expire = 0, $key = '') { if (empty($expire)) { $expire = 0; } return $expire; }
Additional note:
You need to flush the cache, since docket cache will modified file timestamp to maxttl timestamp. The older cache file will no effect to newer setting if not removed.
Docket cache will check the cache path must have /docket-cache/ for security reason to avoid accidentally delete system file, and only max to 2 depth.
file: includes/src/Filesystem.php line 22 (function is_docketcachedir)
Thanks.
- This reply was modified 4 years ago by Nawawi Jamili.
Forum: Plugins
In reply to: [Docket Cache - Object Cache Accelerator] GC is not cleaning files and memory@elig7 please download and try dev version here https://docketcache.com/devtest/docket-cache-dev3.zip
and click “Run Garbage Collector” button. It will display debug message like this
Running the garbage collector successful: Array ( [cache_maxttl] => 345600 [cache_maxfile] => 50000 [cache_maxdisk] => 524288000 [cleanup_maxfile] => 0 [cleanup_maxttl] => 0 [cleanup_maxdisk] => 0 [cache_file] => 574 [cache_cleanup] => 0 [cache_ignore] => 0 [cleanup_failed] => 0 )
cleanup_maxfile = Total deleted file If reach maximum file
cleanup_maxttl = Total deleted file If reach maximum TTL
cleanup_maxdisk = Total deleted file If reach maximum disk size
cleanup_failed = Total file if GC failed to delete the cache file
cache_file = Total current cache file
cache_cleanup = Total deleted file
cache_ignore = Total file ignored which is not cache fileThanks.
Forum: Plugins
In reply to: [Docket Cache - Object Cache Accelerator] GC is not cleaning files and memory@elig7 Maybe I need do more testing on DOCKET_CACHE_CONTENT_PATH. Will fix it if found any issue.
Btw, the cache stats stored in docket-cache-data/cachestats.php .
Thanks.
Forum: Plugins
In reply to: [Docket Cache - Object Cache Accelerator] GC is not cleaning files and memoryHi @sterndata,
Thanks for your response. I just need to mention it since don’t want to look weird if replying in another post.
Thanks.
Forum: Plugins
In reply to: [Docket Cache - Object Cache Accelerator] GC is not cleaning files and memoryHi @elig7,
1. GC is never run automatically and when I trigger it manually it complete successfully however as I understood from your prevues response, expired files should be set to 0 but in fact I see 0 files of that size, am I missing someting?
GC automatically run depend on WordPress Cron. If no wp-cron is running, GC will not run.
This is how GC handle cache file:
1. It will read all files in the cache folder and start counting the file.
2. It will delete cache file if the size is 0 and more than 5 minutes.
3. It will delete the next file when counting reach MAXFILE.
4. It will delete the next file if total size reach MAXDISK.
5. If cache file is valid and “timeout” key in cache file is not 0 and current timestamp bigger than “timeout”, the file will delete.
6. If cache file is valid and “timeout” key in cache file is 0, it will compare “timestamp” key in cache file with MAXTTL. If lower than MAXTTL it will delete.
7. If cache file is not valid, if file modified time is lower than MAXTTL, the file will delete.Valid cache file means, it contains docket cache format. You can refer the GC code in includes/src/Event.php at line 172 (function garbage_collector)
2. Second problem is the cached files are now part of the opcache.max_accelerated_files but even if you will set those to 0 the php opcache never cleaned them and very fast this max file is reached and the server keeps restarting.
No, it is not. OPcache is part of server configuration. Docket cache only can access what PHP provides. What shown in Overview stats is what docket cache can access, and we only follow the opcache.max_accelerated_files limit and make it as max limit in MAXFILE. You can refer stats code in includes/src/Plugin.ph at line 353.
If opcache.max_accelerated_files set to 0, OPcache only use shared memory and when no room to store the cache, it will restart itself. You need to configure properly based on your server environment.
3. I set DOCKET_CACHE_MAXFILE to 15000 so I can see what happen when this limit is reached and the files keep on accumulating way after this value. Any idea?
Cache files only reduced if GC is run. It not like realtime service that counting the max file.
If files reach the max, GC should remove the file. If you referring to overview stats, the stats data is updating in the background, you need to wait a few seconds.
I’m suggesting to test it using wp-cli, you can run “wp cache gc” and can confirm it right away.
Thanks.
Forum: Plugins
In reply to: [Docket Cache - Object Cache Accelerator] GC is not cleaning files and memorypreviously cannot reply here because I’m putting link on it and it held on moderation “This post has been held for moderation by our automated system and will be manually reviewed by a moderator.”
Forum: Plugins
In reply to: [Ghostbird WP (Beta)] How to install it?Hi, please don’t use it. It not suitable for shared hosting or low-spec server, and it has a flaw on locking file when read/write. This plugin maybe will not leave the “beta” stage.
Btw, you can try “docket cache” for object caching alternative to Redis and Memcached.
Forum: Plugins
In reply to: [WP Reroute Email] Option to disable admin error noticeHi, no need to, already add it myself. Thanks.
Hi there,
Yes, it is compatible. By design, docket cache does not interfere with page caching.
Thanks.
Forum: Plugins
In reply to: [Docket Cache - Object Cache Accelerator] SQL Error in 20Hi,
Fixed and updated in version 20.10.03.
Thanks.
Forum: Plugins
In reply to: [Docket Cache - Object Cache Accelerator] SQL Error in 20Hi.
Thank you for reporting this issue, really appreciate it. Will update in few minutes.
Thanks.
Forum: Plugins
In reply to: [Docket Cache - Object Cache Accelerator] Max Cache files not respectedI’m closing this topic and mark as resolved. Thanks.
Forum: Plugins
In reply to: [Docket Cache - Object Cache Accelerator] Max Cache files not respectedHi @elig7,
Please download another dev version https://docketcache.com/devtest/docket-cache-dev2.zip
1) Replace wp-content/object-cache.php using this wrapper https://gist.githubusercontent.com/nawawi/5ad059f5d23783567ed16d2eb7deeda5/raw/9f6c928156f446da8d7de33e0a3c4b8bdf336957/object-cache.php
2) define new constant DOCKET_CACHE_DROPINO_ALTERNATIVE to true
define('DOCKET_CACHE_DROPINO_ALTERNATIVE', true);
3) Disable/Enable object cache at Overview page.
Hope this will solve your requirement.
Thanks.
Forum: Plugins
In reply to: [Docket Cache - Object Cache Accelerator] Max Cache files not respectedHi,
No, it can’t be changed, unless you change WP_CONTENT_DIR and move all the wp-content/* to /tmp/ramdisk.
The object-cache.php file is one of WordPress drop-in file, purposely to handle external object cache. Please refer this website or just googling “wordpress drop-in”.
https://kevdees.com/what-are-wordpress-drop-in-plugins/
https://wordpress.stackexchange.com/questions/103945/changing-wp-content-dir-and-wp-content-url-in-wp-config-php-does-not-registerAlternative option is to modify WordPress files:
wp-includes/load.php –> refer: wp_start_object_cache()
wp-includes/cache.phpThat’s all.
Thanks.
Forum: Plugins
In reply to: [Docket Cache - Object Cache Accelerator] Max Cache files not respectedHi @elig7,
You can download dev version here https://docketcache.com/devtest/docket-cache-dev1.zip
and define new constant DOCKET_CACHE_CONTENT_PATH
define('DOCKET_CACHE_CONTENT_PATH', '/tmp/ramdisk')
By default, If this constant not defined, it will use WP_CONTENT_DIR. And no need to define DOCKET_CACHE_PATH and DOCKET_CACHE_DATA_PATH any more.
You can execute gc by using the action button “Run Garbage Collector” at Overview page.
Thanks.