Пример #1
0
 /**
  * Clean mr_cache
  */
 public function cleancache_action()
 {
     global $CFG;
     $cache = new mr_cache();
     $cache->clean();
     $this->notify->good('cachecleaned');
     return $this->output->single_button(new moodle_url("{$CFG->wwwroot}/{$CFG->admin}/settings.php?section=local_mr_cache"), get_string('continue'));
 }
Пример #2
0
 public function test_cache_broken()
 {
     if (!defined('MR_CACHE_TEST')) {
         return;
     }
     $old = mr_var::instance()->get('mrconfig')->cache_lifetime;
     mr_var::instance()->get('mrconfig')->cache_lifetime = 0;
     $cache = new mr_cache('test/mr/cache');
     $this->assertFalse($cache->test('key'));
     $this->assertTrue($cache->save('value', 'key'));
     $this->assertFalse($cache->test('key'));
     $this->assertFalse($cache->load('key'));
     $this->assertTrue($cache->touch('key', 60));
     $this->assertTrue($cache->remove('key'));
     mr_var::instance()->get('mrconfig')->cache_lifetime = $old;
 }