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();
        }
  • 相关阅读:
    Root of AVL Tree
    04-树4 是否同一棵二叉搜索树
    03-树3 Tree Traversals Again
    03-树2 List Leaves
    283. Move Zeroes
    506. Relative Ranks
    492. Construct the Rectangle
    476. Number Complement
    461. Hamming Distance
    389. Find the Difference
  • 原文地址:https://www.cnblogs.com/pan2011/p/3650302.html
Copyright © 2011-2022 走看看