Quote from: sottwell at Aug 15, 2008, 04:22 AM
I noticed that there is a list of document aliases for each document in the cache. I would imagine 6000 rows of aliases would enlarge the cache considerably. If you could see your way to using an alias prefix, like "page", and leaving the alias blank so it will use the doc ID instead (resulting in URLs like page35.html) I think it would cut down on the size a lot. If you’re using friendly alias paths, you could give your parent documents aliases so you would have the path as a proper alias; there shouldn’t be so many of those that it would load up the cache file.
Thank you for the suggestion Susan, but I need aliases to function so I started hacking away by removing all alias lines from the siteCache (uncomment all lines in cache_sync.class.processor.php involving the alias array -> ~line 112,113,130), knocking off 25% of the siteCache filesize and providing a slight speed improvement.
Then I did this:
The siteCache contains a line for every document’s alias, such as:
$a[8] = array('id' => 8, 'alias' => 'search-results', 'path' => '');
I don’t need the alias line for every doc because I can rewrite the url using the documentListing variable. Example:
$d['search-results'] = 8;
So in document.parser.class.inc.php in the rewriteUrls function, I removed the foreach that iterates thru $this->aliasListing and changed it to:
foreach($this->documentListing as $k => $v)
{
$aliases[$v] = $k;
}
Since snippets like AjaxSearch just pass the docid to the makeUrl function and the makeUrl function uses $this->aliasListing (which we removed), I had to fix makeUrl function in doc parser file. I changed:
elseif ($this->config['friendly_urls'] == 1 && $alias == '') {
$alias= $id;
if ($this->config['friendly_alias_urls'] == 1) {
$al= $this->aliasListing[$id];
$alPath= !empty ($al['path']) ? $al['path'] . '/' : '';
if ($al && $al['alias'])
$alias= $al['alias'];
}
$alias= $alPath . $this->config['friendly_url_prefix'] . $alias . $this->config['friendly_url_suffix'];
$url= $alias . $args;
}
to:
elseif ($this->config['friendly_urls'] == 1 && $alias == '') {
if ($this->config['friendly_alias_urls'] == 1) {
$al = array_search($id,$this->documentListing);
$alias = ($al == TRUE) ? $al : '';
}
$alias= $alPath . $this->config['friendly_url_prefix'] . $alias . $this->config['friendly_url_suffix'];
$url= $alias . $args;
}
This is similar thinking to what andytwiz said he did in the
other similar thread about this subject, although he didn’t cache anything and retrieved necessary info from database.
I have 405 documents now and my siteCache is 130kb. Will be knocking it down to about 40kb when I move all chunks and snippets to external files.