Generates the cache key for the given string using the content in pattern
    to format the output string
966326
def generate_key(s, pattern="%s.txt"):
    
    h = hashlib.sha1()
    #h.update(s)
    h.update(s.encode('utf-8'))
    return pattern % h.hexdigest()
646467
protected String generateCacheKey(
        CmsObject cms,
        String targetSiteRoot,
        String detailPagePart,
        String absoluteLink) {

        return cms.getRequestContext().getSiteRoot() + ":" + targetSiteRoot + ":" + detailPagePart + absoluteLink;
    }
1015580
protected String generateCacheKey(HttpServletRequest request, Map<String, ICacheKeyGenerator> cacheKeyGenerators) throws IOException {
		String cacheKey = null;
		if (cacheKeyGenerators != null) {
			// First, decompose any composite cache key generators into their
			// constituent cache key generators so that we can combine them
			// more effectively.  Use TreeMap to get predictable ordering of
			// keys.
			Map<String, ICacheKeyGenerator> gens = new TreeMap<String, ICacheKeyGenerator>();
			for (ICacheKeyGenerator gen : cacheKeyGenerators.values()) {
				List<ICacheKeyGenerator> constituentGens = gen.getCacheKeyGenerators(request);
				addCacheKeyGenerators(gens,
						constituentGens == null ?
								Arrays.asList(new ICacheKeyGenerator[]{gen}) :
									constituentGens);
			}
			cacheKey = KeyGenUtil.generateKey(
					request,
					gens.values());
		}
		return cacheKey;
	}
35645
public String getCacheKey(String name, Tree params, String... keys) {
		if (params == null) {
			return name;
		}
		StringBuilder key = new StringBuilder(128);
		key.append(name);
		key.append(':');
		serializeKey(key, params, keys);
		return key.toString();
	}
720916
function genStorageKey (ns, key) {
  return (ns === '') ? ns.concat(key) : ns.concat('.').concat(key);
}
93834
public static String generate(String prefix,Object...args){
		if(args == null || args.length == 0)return prefix;
		StringBuilder keyBuilder = new StringBuilder(prefix);
		
		String keyString = null;
		if(args != null && args.length > 0){
			keyBuilder.append(":");
			StringBuilder argsBuilder = new StringBuilder();
			for (int i = 0; i < args.length; i++) {
				if(args[i] == null){
					argsBuilder.append("_null");
				}else if(isSimpleDataType(args[i])){
					argsBuilder.append(args[i].toString());
				}else if(args[i] instanceof Collection){
					argsBuilder.append(args[i].toString().replaceAll("\\s{0,}", ""));
				}else{
					argsBuilder.append(ToStringBuilder.reflectionToString(args[i], ToStringStyle.SHORT_PREFIX_STYLE));
				}
				if(i < args.length - 1)argsBuilder.append("_");
			}
			keyString = argsBuilder.length() > 32 ? md5(argsBuilder) : argsBuilder.toString();
			keyBuilder.append(keyString);
		}
		return keyBuilder.toString();
	}
547671
def fetch_cache_key(request):
        
        m = hashlib.md5()
        m.update(request.body)

        return m.hexdigest()
220044
def cached(key, path_info, details, locals)
      name, prefix, partial = path_info

      if key
        @cache.cache(key, name, prefix, partial, locals) do
          yield
        end
      else
        yield
      end
    end
1113426
def get_cache_key(user_or_username, size, prefix):
    
    if isinstance(user_or_username, get_user_model()):
        user_or_username = get_username(user_or_username)
    key = six.u('%s_%s_%s') % (prefix, user_or_username, size)
    return six.u('%s_%s') % (slugify(key)[:100],
                             hashlib.md5(force_bytes(key)).hexdigest())
644226
def writeCache(self, cachekey, content):
        """"""
        self.rendercache[cachekey] = content
        try:
            open(cachekey, 'w').write(content)
        except:
            print("Error writing cache file", cachekey, ", will regenerate next time")
            traceback.print_exc()
        return content
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
389555
protected String cacheKey(BoId id) {
        String result = StringUtils.join(id.values, "-");
        return StringUtils.isBlank(cacheKeyPrefix) ? result : (cacheKeyPrefix + result);
    }
811889
function compileKeys(urls) {
    return urls.map(function (url) {
        // replace named params with regexp groups
        var pattern = url[0].replace(/\/:\w+/g, '(?:/([^\/]+))');
        url[0] = new RegExp('^(?:' + pattern + ')$');
        return url;
    });
}
958398
def cache_key_name(cls, *args):
        """"""
        if cls.KEY_FIELDS != ():
            if len(args) != len(cls.KEY_FIELDS):
                raise TypeError(
                    "cache_key_name() takes exactly {} arguments ({} given)".format(len(cls.KEY_FIELDS), len(args))
                )
            # pylint: disable=unicode-builtin
            return 'configuration/{}/current/{}'.format(cls.__name__, ','.join(six.text_type(arg) for arg in args))
        else:
            return 'configuration/{}/current'.format(cls.__name__)
200806
String getStringByID(long stringID) {
        Long stringIDObj = new Long(stringID);
        String string = (String) stringCache.get(stringIDObj);
        if (string == null) {
            string = createStringByID(stringID);
            stringCache.put(stringIDObj,string);
        }
        return string;
    }
1247293
def build_string(self, *pattern, **kwargs):
        
        set_defaults(self._string_defaults, kwargs)
        set_defaults(self._defaults, kwargs)
        return StringPattern(*pattern, **kwargs)
611667
function getCacheKey (args, methodMeta) {
    // get cache data from method meta data
    var cache = methodMeta.cache
    // if cache spec has a list of params specified then use these
    if (cache.keyParams) {
        args = _.pick(args, cache.keyParams)
    }
    // otherwise use everything except session
    else {
        // shallow clone args
        args = _.clone(args)
        // delete session from clone
        delete args.session
    }
    // generate hex id for arg data
    return stableId({
        args: args,
        method: methodMeta.signature,
    })
}