Module doesn't work... possible fix...
Tyrbok - February 5, 2008 - 23:49
| Project: | File Cache |
| Version: | 5.x-5.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
Description
I think I found a mistake in the code:
On cache_set() you save the data as an array:
$cache = array(
'data' => $data,
'created' => time(),
'expire' => $expire,
'headers' => $headers,
);But on cache_get() you use like an object. ej:
$cache->data = db_decode_blob($cache->data);I've attached a file with my fix.
¡Great module! thanks

#1
I'm not seeing an attached file...
#2
ooops!! sorry!! the code....
#3
Cool! Thanks Tyrbok, I'm give this module a spin with your code and report back.
#4
Tyrbok, have you got this module to work? I'm a bit confused, it looks like it hasn't been finished yet. There is no data in the filecache.module file, no settings to specify where the cache is written. For instance, how is the variable filecache_path set?
Is this an unfinished module or is someone actively developing it?
#5
Hi Tanc, that's not really a module (I think), it's a patch. You need to replace the file /includes/cache.inc (which writes the cache on the database) with my file (which writes the cache on by default on /files/cache/).
Using the original package you must replace /includes/cache.inc with filecache.inc
I don't need to install as a module... I don't know the reason to make it as a module :(
#6
I see now. The way I used this was to add the module in /sites/all/modules/ then replaced the filecache.inc file with your patched version. Rather than replace /includes/cache.inc I used the following in my settings.php file:
/*** Variable overrides:
*
* To override specific entries in the 'variable' table for this site,
* set them here. You usually don't need to use this feature. This is
* useful in a configuration file for a vhost or directory, rather than
* the default settings.php. Any configuration setting from the 'variable'
* table can be given a new value.
*
* Remove the leading hash signs to enable.
*/
$conf = array(
'cache_inc' => './sites/all/modules/filecache/filecache.inc',
);
This means I didn't have to patch a core file.
I noticed there were some issues at first, based around the minimum cache lifetime (cache->expires) setting. I found that I had to set a minimum cache and then set it back to none before this module starting working without errors. It seems like the $expires variable needs to be set somewhere if the site hasn't yet had it set through the performance menu.
My initial findings with this module are that it does not appear to be working as expected. The cached data seems to be written out to file on every page load and not read back as I expected it should. For instance, if I change some of the data in one of the cached files and reload the page the data is overwritten. I expected the file to stay the same and be used to display the page, but instead it looks like Drupal is recreating the cache on each load.
Any ideas? Have you got this module working properly?