• Resolved elig7

    (@elig7)


    Hi,
    I am testing the plugin on WordPress 5.5.1, php 7.4.7 and plugin Version 20.09.06.
    I configured ram disk on external path to wp-content and set it using the
    define( ‘DOCKET_CACHE_PATH’, ‘/tmp/ramdisk/cache/docket-cache/’ );
    define( ‘DOCKET_CACHE_DATA_PATH’, ‘/tmp/ramdisk/docket-cache-data/’ ); FYI – This is not documented.

    I wanted to test the behaviour when reaching the max file and max file size so I set it using to lower values
    define(‘DOCKET_CACHE_MAXSIZE_DISK’, 524288000);
    define(‘DOCKET_CACHE_MAXFILE’, 5000);
    but is looks they don’t have any affect, the config is correct on the wordpress dashboard but it is using more storage and creating more files. Any idea? also what should be the expected behaviour once crossing the threshold?

    Thanks

    • This topic was modified 4 years, 4 months ago by elig7.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Nawawi Jamili

    (@nawawijamili)

    Hi,

    Thank you for using docket cache.

    Firstly, DOCKET_CACHE_DATA_PATH constant it is for Docket Cache configuration path. When saving any option at Configuration page, the setting will be saved in DOCKET_CACHE_DATA_PATH/options.php file.

    Please use DOCKET_CACHE_PATH constant instead, if you need to change the cache file path.

    This plugin will do the checking and cleanup using cron event docketcache_gc (garbage collector). To reduce the disk I/O, when flushing the cache file, it will empty the file instead of deleting it.

    If the cache file timestamps more than 5 minutes, it means no new data, the garbage collector will remove it.

    You can try to test it again by using Cronbot -> “Run All now” or using wp-cli -> “wp cache gc”

    Thanks.

    Thread Starter elig7

    (@elig7)

    Thank you for the prompt response it is very helpful,
    Because of a unique installation and permission model the plugin don’t have permission to write to wp-content so I added the object-cache.php file to enable the plugin and set DOCKET_CACHE_PATH , DOCKET_CACHE_DATA_PATH and DOCKET_CACHE_LOG_FILE to the ram disk with more permissive options.
    Are there more files that the plugin needs to write to the disk?

    The cron service security-wise is not an option, does the cron tasks suppose to work without it? for now looks like tasks are skipped and the gc never run, any idea why? do we need to implement a call to it?

    Thanks,
    Eli

    Plugin Author Nawawi Jamili

    (@nawawijamili)

    Hi,

    Are there more files that the plugin needs to write to the disk?

    Currently, the plugin need to have write permisson in WP_CONTENT_DIR, because it need to write some file for internal use:

    wp-content/.object-cache-delay.txt
    wp-content/.object-cache-after-delay.txt
    wp-content/.object-cache-flush.txt

    These file hard-coded in includes/src/Dropino.php, includes/src/Filesystem.php and includes/object-cache.php

    The next release, this will move into DOCKET_CACHE_DATA_PATH/

    The cron service security-wise is not an option, does the cron tasks suppose to work without it?

    Yes. the cron service is just an option to make sure the wp-cron running actively. No need to connect, if you don’t need it.

    for now looks like tasks are skipped and the gc never run, any idea why?

    Please try to remove all files under DOCKET_CACHE_DATA_PATH/lock/ or just run wp-cli command “wp cache unlock”

    do we need to implement a call to it?

    I will consider putting an action button to run gc, or just the “run now” option in the cronbot event list in the next release.

    Thanks.

    • This reply was modified 4 years, 4 months ago by Nawawi Jamili.
    Plugin Author Nawawi Jamili

    (@nawawijamili)

    Hi @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.

    Thread Starter elig7

    (@elig7)

    Amazing exactly what I needed, I will try and update…
    So if ‘DOCKET_CACHE_CONTENT_PATH’ is define, will it also place the object-cache.php file in it?

    Plugin Author Nawawi Jamili

    (@nawawijamili)

    Hi,

    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-register

    Alternative option is to modify WordPress files:
    wp-includes/load.php –> refer: wp_start_object_cache()
    wp-includes/cache.php

    That’s all.

    Thanks.

    Plugin Author Nawawi Jamili

    (@nawawijamili)

    Hi @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.

    Plugin Author Nawawi Jamili

    (@nawawijamili)

    I’m closing this topic and mark as resolved. Thanks.

    Thread Starter elig7

    (@elig7)

    Hi Again and thank you so much for this fine help,

    I installed the latest version and I am using the new parameter DOCKET_CACHE_CONTENT_PATH + wrapper and it works perfectly.

    I have serious concern regarding the GC and memory management:

    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?

    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.

    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?

    Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Max Cache files not respected’ is closed to new replies.