@OP:
Below is some commented code to achieve what you asked.
@cletus:
You said memcached is what the OP wants, and that this is not what Squid is designed for.
I don't know what Squid was designed for but I know what it is used for and there are definitely people using it as a reverse proxy to take load off dynamic page generation. No "tie-in" is needed except standard HTTP headers.
I'm not sure why you're so quick to recommend memcached without knowing more about the nature of the application and environment.
<?php
// the time we got hit and generated content
$now = time();
$generatedAt = gmdate('D, d M Y H:i:s T', $now);
// the last modified date (midnight on the same day of generation, as
// per your business-rule)
$lastModified = gmdate('D, d M Y 00:00:00 T', $now);
// date of expiry (24 hours after the last modified date, as per your
// business-rule)
$expiresAt = gmdate('D, d M Y H:i:s T', strtotime($lastModified) + 86400);
// the minimum required http headers to make Squid do what you asked is
// Last-modified and Cache-control. We need to give Cache-control the
// expiry time in terms of "age" (in seconds) so we calculate that below.
// Optionally you could also provide the "Expires: $expiresAt" header to
// tell the browser/client the same information, just in a different way.
// This is not required for Squid though.
$maxAge = strtotime($expiresAt) - strtotime($generatedAt);
header('Last-modified: ' . $lastModified);
header('Cache-control: max-age=' . $maxAge);
// The rest is simply informational
header('Content-type: text/plain');
echo "The content of this page was last modified at $lastModified\n";
echo "This page was generated at $generatedAt and will be cached by Squid for $maxAge seconds until $expiresAt\n";
// Sample output:
//
// The content of this page was last modified at Tue, 13 Jan 2009 00:00:00 GMT
// This page was generated at Tue, 13 Jan 2009 04:29:33 GMT and will be cached by Squid for 70227 seconds until Wed, 14 Jan 2009 00:00:00 GMT