Check for existing script
Brought to you by:
dstogov
What about mmcache make use of file size and CRC32?
Example: Shared environement, 50 sites running the
same forum software, thus caching the exact same
scripts 50 times and waste memory
Would it be possible to check for existing cached script
with the same name, size (even CRC32) with different
path?
For dedicated server, this will be wasting cpu time, but
on shared hosting, this can helps
Maybe make it as a new optinal feature?
mmcache.check_duplicate = 1
Logged In: YES
user_id=124551
I think the best way to solve this problem is to make symlink
to the forum's directory from each site.
Your idea about "mmcache.check_duplicate" can work, but it
will take a lot of time to find duplicates.
In any case I will not implement it before 2.4.0.
Logged In: YES
user_id=185131
what about caching crc with content?
and hash crc, not only filename or inode
(i doubt crc32 is enough, md5 should be fine)
explain in php: (i didn't look into mmcache source)
$md5 = md5($content);
$md5_to_filename[$md5] = $filename;
$filename_to_info[$filename] = array(
'opcode' => compile($content), // NULL if we can use md5
to find another cached file
'md5' => $md5
'mtime' => mtime($filename),
);
lookup:
if (isset($filename_to_info[$filename])) {
$info = &$filename_to_info[$filename];
if (!$info['opcode']) {
$f = &$md5_to_filename[$md5];
if (isset($filename_to_info[$filename])) {
$info = &$filename_to_info[$filename];
if ($info['opcode']) {
// found
}
else {
// not found
}
}
else {
// not found
}
}
else {
$opcode = &$info['opcode'];
// found
}
}
Logged In: YES
user_id=851701
Why won't CRC32 be enough?
MD5 is overkill and is slower than a crc32