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();
        }
  • 相关阅读:
    12-29 批量删除
    12-29 注册审核
    12-25造数据库面向对象
    12-23 会话保持
    2016-12-19 php修改数据库数据
    12-18数据访问
    12-16php测试题
    1027 制作表格
    1027 超链接
    1027 HTML
  • 原文地址:https://www.cnblogs.com/pan2011/p/3650302.html
Copyright © 2011-2022 走看看