Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function register_action($action) {
- error_log(microtime(true) . "\n", 3, "/tmp/tagmy.$action");
- }
- function log_info($msg) {
- error_log(date("Y-m-d H:i:s") . " $msg\n", 3, "/tmp/tagmy.log.info");
- }
- function try_from_cache() {
- global $memcache;
- if ($memcache) {
- $img = $memcache->get(file_name());
- if ($img) {
- log_info('memcache hit for ' . file_name() . ' ' . $_SERVER["REQUEST_URI"]);
- register_action("image.cached");
- send_headers();
- echo $img;
- exit();
- } else {
- log_info('memcache miss for ' . file_name() . ' ' . $_SERVER["REQUEST_URI"]);
- }
- }
- }
- function do_image() {
- global $UriParts;
- try_from_cache();
- ... lots of work to make the image ...
- register_action("image.created");
- }
Add Comment
Please, Sign In to add comment