<?php
$memcache_obj = new Memcache;
$memcache_obj->connect('127.0.0.1', 11211) or die("err");
$file_path = $_GET['s']
$var_key = @$memcache_obj->get($file_path);
if(!empty($var_key)){
http_response_code(200);
echo $var_key;
} else {
$file_data = file_get_contents($file_path);
if($file_data){
http_response_code(200);
$memcache_obj->set($file_path, $file_data, false, 5);
} else {
http_response_code(404);
}
}
$memcache_obj->close();
?>