Generate suitable key to cache twitter tag context
506413
def get_search_cache_key(prefix, *args):
    
    key = '%s_%s' % (prefix, '_'.join([str(arg) for arg in args if arg]))
    not_allowed = re.compile('[^%s]' % ''.join([chr(i) for i in range(33, 128)]))
    key = not_allowed.sub('', key)
    return key
559937
def _encoded_routing_key(self):
        """"""
        topic = self.topic
        if config.conf["topic_prefix"]:
            topic = ".".join((config.conf["topic_prefix"].rstrip("."), topic))
        return topic.encode("utf-8")
934321
def get_action_cache_key(name, argument):
    """"""
    tokens = [str(name)]
    if argument:
        tokens.append(str(argument))
    return '::'.join(tokens)
575429
def tr8n_translations_cache_tag(opts = {})
      html = []

      opts[:translations_element_id] ||= :tr8n_translations
      client_sdk_var_name = opts[:client_var_name] || :tr8nProxy

      default_source_url = "#{controller.controller_name}/#{controller.action_name}.js"
      source = Tr8n::TranslationSource.find_or_create(opts[:source] || default_source_url)

      if Tr8n::Config.enable_browser_cache?  
        # translations are loaded through a script
        js_source = "/tr8n/api/language/translate.js?cache=true&callback=Tr8n.SDK.Proxy.registerTranslationKeys&source=#{CGI.escape(source.source)}&t=#{source.updated_at.to_i}"
        html << "<script type='text/javascript' src='#{js_source}'></script>"
      else  
        # translations are embedded right into the page
        html << "<script>"

        keys = Tr8n::TranslationKey.where(["(id in (select distinct(translation_key_id) from tr8n_translation_key_sources where translation_source_id = ?))", source.id])
        translations = []
        keys.each_with_index do |tkey, index|
          trn = tkey.translate(Tr8n::Config.current_language, {}, {:api => true})
          translations << trn 
        end

        html << "Tr8n.SDK.Proxy.registerTranslationKeys(#{translations.to_json});"
        html << "</script>"
      end
        
      html.join('').html_safe
    end
1316107
def _get_context_key(self, **kwargs):
        
        return str(kwargs.get(self._resource.parent.id_name))
547671
def fetch_cache_key(request):
        
        m = hashlib.md5()
        m.update(request.body)

        return m.hexdigest()
456103
function(namespace, key) {
            key = JSON.stringify(key);
            return "cache_" + configs.revision + "_" + namespace + "_" + key;
        }
419585
def _gen_key(self, key):
        
        b_key = self._md5_digest(key)
        return self._hashi(b_key, lambda x: x)
720916
function genStorageKey (ns, key) {
  return (ns === '') ? ns.concat(key) : ns.concat('.').concat(key);
}
1031455
def cache_keys(keys):
    """"""
    d = known_keys()
    known_names = dict(zip(d.values(), d.keys()))
    for k in keys:
        i = (ord(k),) if len(k) == 1 else known_names[k]
        _key_cache.insert(0, i)
246720
def get_tag_context(name, state):
    
    new_contexts = 0
    ctm = None
    while True:
        try:
            ctx_key, name = name.split('.', 1)
            ctm = state.context.get(ctx_key)
        except ValueError:
            break
        if not ctm:
            break
        else:
            state.context.push(ctm)
            new_contexts += 1

    ctm = state.context.get(name)

    return new_contexts, ctm
401042
def cache(key)
      key_hash = key2hash(key)
      read(key_hash) || (write(key_hash, yield) if block_given?)
    end
902252
def cache_key(self):
        """"""
        try:
            return self.path
        except TypeError:
            raise TypeError("self.path is invalild: '{}', '{}'".format(str(self.path), type(self.path)))
987805
function entitytag (entity) {
  if (entity.length === 0) {
    // fast-path empty
    return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"'
  }

  // compute hash of entity
  var hash = crypto
    .createHash('sha1')
    .update(entity, 'utf8')
    .digest('base64')
    .substring(0, 27)

  // compute length of entity
  var len = typeof entity === 'string'
    ? Buffer.byteLength(entity, 'utf8')
    : entity.length

  return '"' + len.toString(16) + '-' + hash + '"'
}
846079
def get_output_cache_key(self, placeholder_name, instance):
        
        cachekey = self.get_output_cache_base_key(placeholder_name, instance)
        if self.cache_output_per_site:
            cachekey = "{0}-s{1}".format(cachekey, settings.SITE_ID)

        # Append language code
        if self.cache_output_per_language:
            # NOTE: Not using self.language_code, but using the current language instead.
            #       That is what the {% trans %} tags are rendered as after all.
            #       The render_placeholder() code can switch the language if needed.
            user_language = get_language()
            if user_language not in self.cache_supported_language_codes:
                user_language = 'unsupported'
            cachekey = "{0}.{1}".format(cachekey, user_language)

        return cachekey
1283161
def get_cache_key(content, **kwargs):
    ''''''
    cache_key = ''
    for key in sorted(kwargs.keys()):
        cache_key = '{cache_key}.{key}:{value}'.format(
            cache_key=cache_key,
            key=key,
            value=kwargs[key],
        )

    cache_key = '{content}{cache_key}'.format(
        content=content,
        cache_key=cache_key,
    )

    # fix for non ascii symbols, ensure encoding, python3 hashlib fix
    cache_key = cache_key.encode('utf-8', 'ignore')
    cache_key = md5(cache_key).hexdigest()

    cache_key = '{prefix}.{version}.{language}.{cache_key}'.format(
        prefix=settings.ACTIVE_URL_CACHE_PREFIX,
        version=__version__,
        language=get_language(),
        cache_key=cache_key
    )

    return cache_key
633126
def get_confirmation_key(self, tag='', timestamp=None):
        
        return generate_confirmation_key(b64decode(self.identity_secret), tag,
                                         self.get_time() if timestamp is None else timestamp)