• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Lack of interest Registry & Cache Rebuild Manager

xf_phantom

Well-known member
#1
That's something what is bothering me since the first public XF Version.

Couldn't we get some UI in the acp, where we can manage the "cached" values from the registry (and also e.g. addon caches)? (like the mybb cache manager http://docs.mybb.com/Admin_CP_Cache_Manager.html )

this makes peoples life easier, if they run into problems like http://xenforo.com/community/threads/phantom-1-user-awaiting-approval.56870/ or
http://xenforo.com/community/threads/errorexception-undefined-index-text_direction.56801/


It's also perfect while addon development for scenarios e.g. just think about an addon with own content type handlers.. everytime you create a new handler, you need to refresh the cache, but there's no way to do this.. you need to trigger the rebuild yourself.. ( http://xenforo.com/community/threads/content-types-and-fields-handlers.53217/ )


In the end, this system would just need a title, a description for the UI and the callback class & method



e.g.
PHP:
$caches = array(
'users_to_moderate' = array('titlePhrase' => 'title',
'descriptionPhrase' => 'desc',
'callbackclass' =>'XenForo_RegistryCallbacks' , 'callback_method' => 'rebuildUsersToModerate'
)
);


This system would make posts like "create or edit a language, to trigger the cache rebuild" unnecessary;)
 
Last edited:

xf_phantom

Well-known member
#2
Another usage scenario:
Addons could "hook" into this system and add their own callback methods.


This would also be less work for 3rd parties and a great alternative to the current cache rebuild page (which is IMO limited) because it doesn't provide everything (and isn't the cacherebuilder also deprecated?)

aTM we have to add this via event listener
PHP:
XenForo_CacheRebuilder_Abstract::$builders['MyAddonThing'] = 'MyAddon_CacheRebuild';
and also add it to the template via hooks or the template merge system
 

Chris D

XenForo developer
Staff member
#3
With XenForo 1.2 is there any reason to use the CacheRebuilder rather than a Deferred method?

With Deferred methods that can be executed from the Rebuild Caches page, you do not need to extend the $builders array anymore:

Code:
<xen:form action="{xen:adminlink 'tools/trigger-deferred'}">
    <h2 class="subHeading">{xen:phrase some_deferred_process}</h2>
    <xen:spinboxunit name="options[batch]" value="1000" step="500" min="1" label="{xen:phrase items_to_process_per_page}:" />

    <xen:submitunit save="{xen:phrase rebuild_now}" />
    <input type="hidden" name="cache" value="YourAddOn_Defferred_Process_Class" />
</xen:form>
Just set the value of the hidden input to the class name of your Deferred process.
 

xf_phantom

Well-known member
#4
Code:
<xen:form action="{xen:adminlink 'tools/trigger-deferred'}">
    <h2 class="subHeading">{xen:phrase some_deferred_process}</h2>
    <xen:spinboxunit name="options[batch]" value="1000" step="500" min="1" label="{xen:phrase items_to_process_per_page}:" />

    <xen:submitunit save="{xen:phrase rebuild_now}" />
    <input type="hidden" name="cache" value="YourAddOn_Defferred_Process_Class" />
</xen:form>
No, it was just a "quick example", but the tasks for the 3rd party devs are the same=>
create a template modification which adds this to the cache rebuild page ( no mather if it's now a deferred process, cache rebuild or any other redirect to a 3rd party controller.




IF there would be a "central system" for ALL! cached values(that's the important point of my suggestion) like users to moderate, languages,styles,smilies, etc...(just look at the dependencies), it would IMO make peoples life easier, because they would have a place, where they could do it.

and even if it's just an array with
"key" => datakey which would be just unset and rebuild automatically on the next call because of
PHP:
    if (!is_array($data['smilies']))
     {
       $data['smilies'] = XenForo_Model::create('XenForo_Model_Smilie')->rebuildSmilieCache();
     }
[php]
 
Last edited: