I wish to have a custom cache which uses authcache if needed. Similiar to how authcache loads authcache_handler. The idea being that I want to bypass the bootstrap for certain requests yet still use authcache.
The problem is that authcach won't cache any pages if I change cache_inc
_authcache_is_cacheable() in authcache.helpers.inc
line 27: || (strpos(variable_get('cache_inc',''), 'authcache') === FALSE)
maybe there could be a secondary variable that could be set like this
ie || (strpos(variable_get('cache_inc',''), 'authcache') === FALSE && variable_get('authcache_force',FALSE) !== TRUE)
Cheers,
Derek
Comments
Comment #1
Jonah Ellison commentedHave you tried using $conf['cache_inc_via_authcache'] for your custom code?
http://drupal.org/node/996418
Comment #2
funkmasterjones commentedThanks for the reply
I'm new to this style of caching and I'm experimenting a little, so maybe what I'm trying is strange. I don't actually want to replace the layer below authcache (ie memcache) but instead add a layer above. This I think would have slightly different functionality, but I'm not exactly sure of all the benefits yet. The main one being I don't want to lose authcache setting up the handler (ie memcache) for me.
for most purposes cache_inc_via_authcache would suffice
however there may be some minor limitations:
-can't use authcaches auto detect for 'authcache_handler' (line 28 authcache.inc)
FIX: specify 'authcache_handler' myself in my custom cache handler
-using memcache.inc the page_cache_fastpath() won't init variables (line 110 authcache.inc)
FIX: init variables in my custom cache handler
-can't declare my own page_cache_fastpath()
FIX: could call my_page_cache_fastpath() and then exit before bootstrap gets a chance to call page_cache_fastpath()
so I think with cache_inc_via_authcache you could do some workarounds, but it would get kind of ugly
Thanks!
Comment #3
Jonah Ellison commentedHmm, if you're adding a lot of custom work, you're probably going to need to just create your own cache_inc file, i.e., take authcache.inc, copy to authcache.custom.inc, and make all your changes there. If you don't want to use "authcache" in the name, you can use the global $conf variable and set $conf['cache_inc'] = "authcache" after your cache_inc file has been loaded.
Comment #4
funkmasterjones commentedoops! I missed that its a strpos call so the file just needs to have authcache in its name
I could just use 'mycache.authcache.inc' and that can load authcache.inc when needed
in fact what i'm doing from mycache is removing the HTTP_AUTHCACHE header (for certain requests), running authcache.inc (which loads up the cache_handler for me) then I can:
-run my own routines
-call authcache.php (add header and require file)
-let bootstrap call authcaches page_cache_fastpath()
one of my custom routines is to check the cache for certain blocks. If misses then call '_authcache_blocks' and then set it in cache. This could simply be done by rewriting the request from 'blocks[...]' to 'mycache_blocks[...]' and letting authcache call my custom handler with the name '_authcache_mycache_blocks'. I don't even have to write any function dispatch code!
With this I can run mycache on top of authcache and gain a lot of control, more than I can from just using authcache_custom.php and I don't have to duplicate any code.
Thanks
Comment #5
funkmasterjones commentedIf I change the request then I have to add a js function _authcache_mycache_blocks as well.
Comment #6
simg commented