Skip to content

Commit

Permalink
Purge single site Redis cache in multisite setup
Browse files Browse the repository at this point in the history
See PR: #122
  • Loading branch information
chandrapatel committed Sep 2, 2016
1 parent 02dab11 commit c4dc90d
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions redis-purger.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,12 +672,22 @@ function purge_on_check_ajax_referer( $action, $result )
function true_purge_all()
{
global $rt_wp_nginx_helper;
$prefix = substr($rt_wp_nginx_helper->options['redis_prefix'],0, -1);
$this->log( "* * * * *" );
$this->log( "* Purged Everything!" );
$this->log( "* * * * *" );
//delete_multi_keys("*");
delete_keys_by_wildcard($prefix."*");
$prefix = trim( $rt_wp_nginx_helper->options['redis_prefix'] );

$this->log( '* * * * *' );

// If Purge Cache link click from network admin then purge all
if( is_network_admin() ) {
delete_keys_by_wildcard( $prefix . '*' );
$this->log( '* Purged Everything! * ' );
} else { // Else purge only site specific cache
$parse = wp_parse_url( get_site_url() );
$parse['path'] = empty( $parse['path'] ) ? '/' : $parse['path'];
delete_keys_by_wildcard( $prefix . $parse['scheme'] . 'GET' . $parse['host'] . $parse['path'] . '*' );
$this->log( '* ' . get_site_url() . ' Purged! * ' );
}

$this->log( '* * * * *' );
}

function purge_urls()
Expand Down Expand Up @@ -717,7 +727,7 @@ function purge_urls()
}
}
}
}
}
}

}
Expand Down

0 comments on commit c4dc90d

Please sign in to comment.