Support » Plugins » Auto flush nginx cache

  • Hey there!

    I am developer of nginx-champuru.
    http://wordpress.org/extend/plugins/nginx-champuru/

    I want to implement auto flush nginx cache on this plugin.

    public function flush_caches()
    {
        if (defined("NGINX_DELETE_CACHES") && NGINX_DELETE_CACHES) {
            if (defined("NGINX_CACHE_DIR") && NGINX_CACHE_DIR) {
                $this->cache_dir = NGINX_CACHE_DIR;
            }
            $cmd = sprintf(
                'grep -lr %s %s | xargs rm -f >/dev/null &',
                escapeshellarg(home_url()),
                escapeshellarg($this->cache_dir)
    
            );
            exec($cmd);
        }
    }

    This function will exec on the hooks below.
    (publish_future_post hook will work by ajax.)

    • save_post
    • publish_future_post
    • comment_post

    I want to implement this function safely.
    Please advice me!

    If there are some mistakes in English, I’d like to apologize.

  • The topic ‘Auto flush nginx cache’ is closed to new replies.