public function clear($result)
    {
        $invalid = array();
        $this->get_versions();

        if (isset($result['$cached'])) {
            foreach ((array)$result['$cached'] as $collection => $ver) {
                if (!isset($this->versions[$collection]) || $ver != $this->versions[$collection]) {
                    $this->put_version($collection, $ver);
                    $invalid[$collection] = true;
                    // Hack to make admin.settings affect other api.settings
                    // TODO: figure out how to do this on the server side
                    if ($collection === 'admin.settings') {
                        foreach ((array)$this->versions as $vcoll => $vv) {
                            if (preg_match('/\.settings$/', $vcoll)) {
                                $invalid[$vcoll] = true;
                            }
                        }
                    }
                }
            }
        }
        if (!empty($invalid)) {
            $this->clear_indexes($invalid);
        }
    }