Fetches the table and applies all post processors.
        Args:
            rebuild (bool): Rebuild the table and ignore cache. Default: False
            cache (bool): Cache the finished table for faster future loading.
                Default: True
179136
def fetch(self, rebuild=False, cache=True):
        
        if rebuild:
            return self._process_table(cache)
        try:
            return self.read_cache()
        except FileNotFoundError:
            return self._process_table(cache)
1062907
def restore(self):
        
        url = self.build_url(
            self._endpoints.get('restore').format(id=self.object_id))

        response = self.con.post(url)

        return bool(response)
1317124
def _build_cache(self):
        
        self.cache = []
        if self.done:
            return

        for i in (self.get_cached() if self._cached else self.get_page(self.url)):
            if not self._cached:
                # some objects don't have objectType set (inbox activities)
                if not i.get("objectType"):
                    i["objectType"] = self.feed.object_types[0]
                obj = Mapper(pypump=self.feed._pump).get_object(i)

            else:
                obj = i
            self.cache.append(obj)

        # ran out of items
        if len(self.cache) <= 0:
            self._done = True

        # check what to do next time
        if getattr(self.feed, 'issue65', False):
            # work around API bug for favorites feed, see https://github.com/xray7224/PyPump/issues/65
            if self._offset is None:
                self._offset = 0
            self._offset += 20
        elif self._since is not None:
            if self.feed.links.get('prev'):
                self.url = self.feed.links['prev']
                del self.feed.links['prev']  # avoid using it again
        else:
            if self.feed.links.get('next'):
                self.url = self.feed.links['next']
                del self.feed.links['next']  # avoid using it again
            else:
                self.url = None
366079
def rebuild_all_apps(force=True, restart=False):
    '''
        
    '''
    cozy_apps = monitor.status(only_cozy=True)
    for app in cozy_apps.keys():
        rebuild_app(app, force=force, restart=restart)
988721
def data(self):
        
        if self.is_obsolete():
            self.update_cache(self.get_data())
        return self.cache_data
1181119
def _update_cache(self):
        "  "
        expected_version = (self.registry._version, self._extra_registry._version)

        if self._last_version != expected_version:
            registry2 = Registry()

            # Copy all bindings from `self.registry`, adding our condition.
            for reg in (self.registry, self._extra_registry):
                for b in reg.key_bindings:
                    registry2.key_bindings.append(
                        _Binding(
                            keys=b.keys,
                            handler=b.handler,
                            filter=self.filter & b.filter,
                            eager=b.eager,
                            save_before=b.save_before))

            self._registry2 = registry2
            self._last_version = expected_version
757967
def execute(self, ignore_cache=False):
        
        if ignore_cache or not hasattr(self, '_response'):
            es = connections.get_connection(self._using)

            self._response = self._response_class(
                self,
                es.search(
                    index=self._index,
                    body=self.to_dict(),
                    **self._params
                )
            )
        return self._response
474590
def _fetch(self, count=False):
        if self._result_cache is not None:
            return len(self._result_cache) if count else self._result_cache
        
        options = dict(self._options)  # make a local copy
        if self._where:
            # JSON encode WHERE values
            options['where'] = json.dumps(self._where)
        if self._select_related:
            options['include'] = ','.join(self._select_related)
        if count:
            return self._manager._count(**options)

        self._result_cache = self._manager._fetch(**options)
        return self._result_cache
836570
def reload(self, result=None):
        

        if result is None:
            result = self._client._get(
                self.__class__.base_url(
                    self.sys['space'].id,
                    self.sys['id'],
                    environment_id=self._environment_id
                )
            )

        self._update_from_resource(result)

        return self
667409
def refresh!
      raise UnknownObject, self.name unless self.exists?
      h = Rudy::Metadata.get self.name
      return false if h.nil? || h.empty?
      obj = self.from_hash(h)
      obj.postprocess
      obj
    end
1048548
def rebuild!
      unless project = ::Juici::Project.where(name: params[:project]).first
        not_found
      end
      unless build = ::Juici::Build.where(parent: project.name, _id: params[:id]).first
        not_found
      end

      ::Juici::Build.new_from(build).tap do |new_build|
        new_build.save!
        $build_queue << new_build
        $build_queue.bump!
      end
    end
688657
def reflect(self, bind='__all__', app=None):
        
        self._execute_for_all_tables(app, bind, 'reflect', skip_tables=True)
247754
def reload(self):
        
        instance_pb = self._client.instance_admin_client.get_instance(self.name)

        # NOTE: _update_from_pb does not check that the project and
        #       instance ID on the response match the request.
        self._update_from_pb(instance_pb)
1100399
public function rebuild()
    {
        $this->cache->erase();
        $this->reset();
        $this->warmUpCache();
        $this->cache->save();
    }
277122
public void rebuild() throws Exception
    {
        Preconditions.checkState(!executorService.isShutdown(), "cache has been closed");

        ensurePath();

        clear();

        List<String> children = client.getChildren().forPath(path);
        for ( String child : children )
        {
            String fullPath = ZKPaths.makePath(path, child);
            internalRebuildNode(fullPath);

            if ( rebuildTestExchanger != null )
            {
                rebuildTestExchanger.exchange(new Object());
            }
        }

        // this is necessary so that any updates that occurred while rebuilding are taken
        offerOperation(new RefreshOperation(this, RefreshMode.FORCE_GET_DATA_AND_STAT));
    }
1018669
def on_build_finished(app, exception):
    
    if not app.config["uqbar_book_use_cache"]:
        return
    logger.info("")
    for row in app.connection.execute("SELECT path, hits FROM cache ORDER BY path"):
        path, hits = row
        if not hits:
            continue
        logger.info(bold("[uqbar-book]"), nonl=True)
        logger.info(" Cache hits for {}: {}".format(path, hits))
1328631
def build(self, _resource, _cache=True, updatecontent=True, **kwargs):
        
        result = None

        if _cache and _resource in self._schemasbyresource:
            result = self._schemasbyresource[_resource]

        else:
            for builder in self._builders.values():
                try:
                    result = builder.build(_resource=_resource, **kwargs)

                except Exception:
                    pass

                else:
                    break

            if result is None:
                raise ValueError('No builder found for {0}'.format(_resource))

            if _cache:
                self._schemasbyresource[_resource] = result

            if updatecontent:
                from ..utils import updatecontent
                updatecontent(result, updateparents=False)

        return result