Retrieve item from cache
 Store item returned by given block if any
495530
def get(key)
      if @items.include?(key)
        @list.each_index do |i|
          if @list[i] == key
            @list.delete_at(i)
            break
          end
        end
        @list.push(key)
        @items[key]
      else
        return nil unless block_given?
         self[key] = yield
      end
    end
538002
def getblock(self, hash: str) -> dict:
        ''''''

        return cast(dict, self.api_fetch('getblock?hash=' + hash))
825359
def _fetch_cached_output(self, items, result):
        
        if not appsettings.FLUENT_CONTENTS_CACHE_OUTPUT or not self.use_cached_output:
            result.add_remaining_list(items)
            return

        for contentitem in items:
            result.add_ordering(contentitem)
            output = None

            try:
                plugin = contentitem.plugin
            except PluginNotFound as ex:
                result.store_exception(contentitem, ex)  # Will deal with that later.
                logger.debug("- item #%s has no matching plugin: %s", contentitem.pk, str(ex))
                continue

            # Respect the cache output setting of the plugin
            if self.can_use_cached_output(contentitem):
                result.add_plugin_timeout(plugin)
                output = plugin.get_cached_output(result.placeholder_name, contentitem)

                # Support transition to new output format.
                if output is not None and not isinstance(output, ContentItemOutput):
                    output = None
                    logger.debug("Flushed cached output of {0}#{1} to store new ContentItemOutput format (key: {2})".format(
                        plugin.type_name,
                        contentitem.pk,
                        get_placeholder_name(contentitem.placeholder)
                    ))

            # For debugging, ignore cached values when the template is updated.
            if output and settings.DEBUG:
                cachekey = get_rendering_cache_key(result.placeholder_name, contentitem)
                if is_template_updated(self.request, contentitem, cachekey):
                    output = None

            if output:
                result.store_output(contentitem, output)
            else:
                result.add_remaining(contentitem)
1274075
def cache(self, CachableItem):
        
        _cachedItem = self.get(CachableItem)
        if not _cachedItem:
            _cachedItem = self.mapper.get(CachableItem)
            self._add(_cachedItem)
            logger.debug("new cachable item added to Splunk KV cache area {id: %s, type: %s}", str(_cachedItem.getId()), str(_cachedItem.__class__))
            notify(CacheObjectCreatedEvent(_cachedItem, self))
            return _cachedItem
        else:
            _newCacheItem = self.mapper.get(CachableItem)
            if _cachedItem != _newCacheItem:
                logger.debug("Cachable item modified in Splunk KV cache area {id: %s, type: %s}", str(_newCacheItem.getId()), str(_newCacheItem.__class__))
                self._update(_newCacheItem)
                notify(CacheObjectModifiedEvent(_newCacheItem, self))
                return _newCacheItem
        return None
369037
def get(block_id):
    """"""
    _url = get_root_url()
    try:
        block = DB.get_block_details([block_id]).__next__()
        response = block

        response['links'] = {
            'self': '{}'.format(request.url),
            'list': '{}/processing-blocks'.format(_url),
            'home': '{}'.format(_url)
        }
        return block
    except IndexError as error:
        response = dict(message='Unable to GET Processing Block',
                        id='{}'.format(block_id),
                        error=error.__str__())
        response['links'] = {
            'list': '{}/processing-blocks'.format(_url),
            'home': '{}'.format(_url)
        }
        return response, HTTPStatus.NOT_FOUND
807116
def get_item(self, url):
        

        _hash = self.build_hash(url)
        query = {'_id': _hash}
        return self.dbase.cache.find_one(query)
1227998
def get_from_cache(self):
        """"""
        for item in self.rule.output_files:
            dstpath = os.path.join(self.buildroot, item)
            self.linkorcopy(
                self.cachemgr.path_in_cache(item, self._metahash()),
                dstpath)
93346
def fetch(key, cache_options, &block)
      if defined?(Rails)
        Rails.cache.fetch(key, cache_options, &block)
      else
        @cache[key] ||= yield
      end
    end
1125628
def fetch_block(block_size=nil)
      block_size ||= @block_size ||= @options.fetch(:block_size) { 1000 }
      @result = @connection.execute("fetch #{block_size} from cursor_#{@cursor}")

      if @iterate == :each_array
        @block = @result.each_row.collect {|row| row }
      else
        @block = @result.collect {|row| row }
      end
    end
572779
function getPreviousItem(opts: Options, value: Value, block?: Block): ?Block {
    const { document, startBlock } = value;
    block = block || startBlock;

    const currentItem = getCurrentItem(opts, value, block);
    if (!currentItem) {
        return null;
    }

    const previousSibling = document.getPreviousSibling(currentItem.key);

    if (!previousSibling) {
        return null;
    } else if (previousSibling.type === opts.typeItem) {
        return previousSibling;
    }
    return null;
}
340507
def get_item(key):
    """"""
    CACHED_KEY_FILE = os.path.join(CURRENT_DIR, key)

    try:
        return json.loads(open(CACHED_KEY_FILE, "rb").read().decode('UTF-8'))["_"]
    except (IOError, ValueError):
        return None
1358853
def check_cache(self, type, data, obj=None):
        ''''''
        try:
            id = data['id']
        except:
            # Not an identifiable item
            #print 'don\'t know this item %r:%r' % (type, data)
            return data

        # If obj was passed in, its type takes precedence
        try:
            type = obj._get_type()
        except:
            pass

        # Find the item in the cache, update and return if it's there
        try:
            hit = self.item_cache[type][id]
        except KeyError:
            pass
        else:
            hit._update_data(data)
            #print 'cache hit for %s at %s' % (type, id)
            return hit

        # Not there? Let's make us a new item
        # If we weren't given the object ref, find the name in the global scope
        if not obj:
            # Default to Redmine_Item if it's not found
            obj = self.item_class.get(type, Redmine_Item)

        new_item = obj(redmine=self, data=data, type=type)

        # Store it
        self.item_cache.setdefault(type, {})[id] = new_item
        #print 'set new %s at %s' % (type, id)

        return new_item
164335
def get(self, entry):
        """"""
        try:
            list = self.cache[entry.key]
            return list[list.index(entry)]
        except:
            return None
1040839
def cache_results(&block)
        return yield unless template_cache_configured? && defined?(@_cache_key)

        if cache_read_on_render?
          fetch_result_from_cache(cache_key, @_cache_options, &block)
        else
          write_result_to_cache(cache_key, @_cache_options, &block)
        end
      end
838336
def fetch(bank, key, cachedir=None):
    '''
    
    '''
    if cachedir is None:
        cachedir = __opts__['cachedir']

    try:
        cache = salt.cache.Cache(__opts__, cachedir=cachedir)
    except TypeError:
        cache = salt.cache.Cache(__opts__)
    return cache.fetch(bank, key)
594696
def __retrieve(self, key):
        ''' 
        '''
        with self.get_conn() as conn:
            try:
                c = conn.cursor()
                if key is None:
                    c.execute("SELECT value FROM cache_entries WHERE key IS NULL")
                else:
                    c.execute("SELECT value FROM cache_entries WHERE key = ?", (key,))
                result = c.fetchone()
                if result is None or len(result) != 1:
                    getLogger().info("There's no entry with key={key}".format(key=key))
                    return None
                else:
                    return result[0]
            except:
                getLogger().exception("Cannot retrieve")
                return None
55447
def method_for_cached(object, key, fetch_method=:fetch, method_name=nil)
      method_name = ("cached_" + (method_name || key)).gsub(/[^\w\!\?]/, '_')
      method_body = <<-END
        def #{method_name}(*args, &block)
          opts = args.empty? ? {} : args.first

          proxy = AridCache::CacheProxy.new(self, #{key.inspect}, opts, &block)
          if opts[:clear] == true
            proxy.clear_cached
          else
            proxy.#{fetch_method.to_s}
          end
        end
      END
      # Get the correct object
      object = (class << object; self; end) if object.is_a?(Class)
      object.class_eval(method_body, __FILE__, __LINE__)
    end