-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflush-memcache.php
More file actions
34 lines (29 loc) · 959 Bytes
/
flush-memcache.php
File metadata and controls
34 lines (29 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* This file simply provides the user with a button to flush the memcache servers
*
* author: Zachary Brown
*/
//Array of server:port
$memcache_servers = array('127.0.0.1:11211');
if($_POST['submit']){
foreach($memcache_servers as $memserv){
$memparts = explode(':',$memserv);
$servername = $memparts[0];
$serverport = $memparts[1];
$memcache_obj = memcache_connect($servername,$serverport);
if(!$memcache_obj){die("Could not connect to memcache server $servername");}
if(!(memcache_flush($memcache_obj))){die("Could not flush cache of $servername");}
echo "Flush of $servername successful<br>";
}
echo "<br>All servers have been flushed<br>";
exit;
}
?>
<html>
<body>
Please be aware that flushing the cache can lead to performance problems and website slowness for a couple minutes!<br><br>
<form method="post" action="flush-memcache.php">
<input name="submit" type="submit" value="FLUSH CACHE">
</form>
</body></html>