zoukankan      html  css  js  c++  java
  • SSM 是如何生存Key的?

    源码中有一个接口:KeyProvider的 方法 String generateKey(final Object keyObject);

    /**
         * From the supplied object, create a (no-whitespace) part of the key by which a value will be stored in Memcached.
         * (Hint: This value, plus the Namespace value, plus optional other key should be no longer than 250 characters.)
         * 
         * @param keyObject
         * @return
         */
        String generateKey(final Object keyObject);

    根据CacheMethod 返回的值,已经斜线,命名空间生成key

    private String buildCacheKey(final String[] objectIds, final String namespace) {
            if (objectIds.length == 1) {
                checkKeyPart(objectIds[0]);
                return namespace + SEPARATOR + objectIds[0];
            }
    
            StringBuilder cacheKey = new StringBuilder(namespace);
            cacheKey.append(SEPARATOR);
            for (String id : objectIds) {
                checkKeyPart(id);
                cacheKey.append(id);
                cacheKey.append(ID_SEPARATOR);
            }
    
            cacheKey.deleteCharAt(cacheKey.length() - 1);
            return cacheKey.toString();
        }
  • 相关阅读:
    BZOJ 5018 [Snoi2017]英雄联盟
    BZOJ 4945 [Noi2017]游戏
    BZOJ4942 [Noi2017]整数
    BZOJ 2427 [HAOI2010]软件安装
    BZOJ 4870 [Shoi2017]组合数问题
    THINKPHP 全局404
    PHP 万能查询代码
    xml Array 相互转化
    JS 倒计时计算
    PHP 多态
  • 原文地址:https://www.cnblogs.com/pan2011/p/3650302.html
Copyright © 2011-2022 走看看