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

Save options callback. Clear simpleCache

Discussion in 'XenForo Development Discussions' started by Espen Espelund, Feb 17, 2013.

  1. Espen Espelund

    Espen Espelund Active Member

    I got a plugin that saves a query to simpleCache with cron every 5 min.
    When I update the addon options, I obviously want to clear the cache. Are there some way to set up a callback / listener when saving an options group?
     
  2. Espen Espelund

    Espen Espelund Active Member

    Figured it out.

    PHP:
    <?php
    class Fitnessbloggen_HotThreads_ControllerAdmin_Option extends XFCP_Fitnessbloggen_HotThreads_ControllerAdmin_Option
    {
        public function 
    actionSave()
        {
            
    $this->_assertPostOnly();
     
            
    $input $this->_input->filter(array('group_id' => XenForo_Input::STRING));
           
            if (
    $input['group_id'] == "hotthreads") {
                
    XenForo_Application::setSimpleCacheData('hotThreads'false);
            }
     
            return 
    parent::actionSave();
        }
    }
     
    Jake Bunce likes this.

Share This Page