Loads the data for this classifier from a cache file

        :return: whether or not we were successful
        :rtype: bool
337041
def cache_train(self):
        
        filename = self.get_cache_location()

        if not os.path.exists(filename):
            return False

        categories = pickle.load(open(filename, 'rb'))

        assert isinstance(categories, BayesCategories), \
            "Cache data is either corrupt or invalid"

        self.categories = categories

        # Updating our per-category overall probabilities
        self.calculate_category_probability()

        return True
806938
def fetch(self, crc):
        
        cache_data = None
        pattern = '%08X.json' % crc
        hit = None

        for name in self._cache_files:
            if (name.endswith(pattern)):
                hit = name

        if (hit):
            try:
                cache = open(hit)
                cache_data = json.load(cache,
                                       object_hook=self._decoder)
                cache.close()
            except Exception as exp:
                logger.warning('Error while parsing cache file [%s]:%s',
                               hit, str(exp))

        return cache_data
531773
def _load_cache(self, filename):
        """"""
        try:
            with open(filename + self.CACHE_EXTENSION, 'rb') as file:
                prev_number_of_pages, prev_page_references = pickle.load(file)
        except (IOError, TypeError):
            prev_number_of_pages, prev_page_references = {}, {}
        return prev_number_of_pages, prev_page_references
878981
def load(self, key=None):
        # type: (Hashable) -> Promise
        
        if key is None:
            raise TypeError(
                (
                    "The loader.load() function must be called with a value,"
                    + "but got: {}."
                ).format(key)
            )

        cache_key = self.get_cache_key(key)

        # If caching and there is a cache-hit, return cached Promise.
        if self.cache:
            cached_promise = self._promise_cache.get(cache_key)
            if cached_promise:
                return cached_promise

        # Otherwise, produce a new Promise for this value.

        promise = Promise(partial(self.do_resolve_reject, key))  # type: ignore

        # If caching, cache this promise.
        if self.cache:
            self._promise_cache[cache_key] = promise

        return promise
1228429
def check_cache(self, template):
        '''
        
        '''
        if template not in self.cached:
            self.cache_file(template)
            self.cached.append(template)
252414
def load(self):
        

        response = self.table.get_item(
            Key={'session_key': self.session_key},
            ConsistentRead=ALWAYS_CONSISTENT)
        if 'Item' in response:
            session_data = response['Item']['data']
            return self.decode(session_data)
        else:
            self.create()
            return {}
47655
def load_from_store(self):
        
        if not self._store:
            raise AttributeError('No datastore defined!')
        if self._store.has_blob('all_keys'):
            data = Serializer.deserialize(self._store.get_blob('all_keys'))
            self.load_from_data(data)
            return True
        elif self._store.has_blob('all_keys_with_undefined'):
            blob = self._store.get_blob('all_keys_with_undefined')
            data = Serializer.deserialize(blob)
            self.load_from_data(data, with_undefined=True)
            return True
        else:
            return False
305429
def load_cache
      begin
        file = File.join("inline", File.basename(so_name))
        if require file then
          dir = Inline.directory
          warn "WAR\NING: #{dir} exists but is not being used" if test ?d, dir and $VERBOSE
          return true
        end
      rescue LoadError
      end
      return false
    end
1098662
def read_cache(self):
        
        if os.path.exists(self._cache_file):
            self._cache = _read_cache_file(self._cache_file)
        else:
            self._cache = {}
1140065
def load(self):
        
        if self._dict is None:
            if self.dirty:
                self._dict = self._loader(self.filename)
                self.cache()
            else:
                with open(self.cachename, 'rb') as stream:
                    self._dict = cPickle.load(stream)

        return self._dict
418155
def _do_search(self):
        
        if self._results_cache is None:
            response = self.raw()
            ResultsClass = self.get_results_class()
            results = self.to_python(response.get('hits', {}).get('hits', []))
            self._results_cache = ResultsClass(
                self.type, response, results, self.fields)
        return self._results_cache
585835
private function _loadCache() {
    if (true === file_exists($this->getCacheDir())) {
      $file = file_get_contents($this->getCacheDir());
      return json_decode($file, true);
    } else {
      return false;
    }
  }
1238107
@SuppressWarnings("unchecked")
    public void loadCache() {
        if (!cacheManager.isNeedPersist()) {
            return;
        }
        File file = getSaveFile();
        if (null == file) {
            return;
        }
        if (!file.exists()) {
            return;
        }
        BufferedInputStream bis = null;
        try {
            FileInputStream fis = new FileInputStream(file);
            bis = new BufferedInputStream(fis);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            byte buf[] = new byte[1024];
            int len = -1;
            while ((len = bis.read(buf)) != -1) {
                baos.write(buf, 0, len);
            }
            byte retArr[] = baos.toByteArray();
            Object obj = getPersistSerializer().deserialize(retArr, null);
            if (null != obj && obj instanceof ConcurrentHashMap) {
                cacheManager.getCache().putAll((ConcurrentHashMap<String, Object>) obj);
            }
        } catch (Exception ex) {
            logger.error(ex.getMessage(), ex);
        } finally {
            if (null != bis) {
                try {
                    bis.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    }
141855
def read_file(filename: str, force_reload=False):
    

    if force_reload:
        _delete_cached_file(filename)

    reloaded = False
    mtime = os.path.getmtime(filename)
    cache_info = CACHE.setdefault(filename, {})

    if not cache_info or mtime > cache_info.get('mtime', 0):
        LOG.debug('Reloading cached file %s', filename)
        with open(filename) as fp:
            cache_info['data'] = fp.read()
        cache_info['mtime'] = mtime
        reloaded = True

    return reloaded, cache_info['data']
104754
protected function loadFromCacheCache(): bool
    {
        if (file_exists($this->cacheFileName())) {
            $content = @file_get_contents($this->cacheFileName());
            if ($content) {
                TypeRegistry::setTypeMapping(unserialize($content));

                return true;
            }
        }

        return false;
    }
1066264
def _load_cache(self):
        """"""
        if not self._disable_cache:
            if os.path.exists(self._cache_path):
                _LOGGER.debug("Cache found at: %s", self._cache_path)
                if os.path.getsize(self._cache_path) > 0:
                    loaded_cache = UTILS.load_cache(self._cache_path)
                    UTILS.update(self._cache, loaded_cache)
                else:
                    _LOGGER.debug("Cache file is empty.  Removing it.")
                    os.remove(self._cache_path)

        self._save_cache()
625192
def init_cache():
    '''
    
    '''
    cache_obj = json.loads("{}")
    try:
        with open(CACHE_NAME, 'r') as cache_file:
            try:
                cache_obj = json.load(cache_file)
            except ValueError:
                print("The cache file seems to be empty, starting with flushed cache")
    except IOError:
        print("The cache file seems to be empty, starting with flushed cache")

    print("Loaded JSON cache")

    return cache_obj