---
title: "最近寻找 开源论坛"
author: "phantom"
date: "2007-03-09T04:59:51Z"
tags: []
slug: "untitled"
draft: false
lastmod: "2007-03-09T04:59:51Z"
id: 66080
url: "https://phantom.iteye.com/blog/66080"
---

开源论坛 : GamVan BBSCS JdonBBS

很好的论坛:

    [http://bbs.ntsky.com/index.action](http://bbs.ntsky.com/index.action) 还有原代码 是很好的webwork 学习的框架 也可以拿来改造为自己准备资源.他们的思路和想法都不错 值得学习.

   oscache也是一款相当不错的产品 不过就是磁盘存储这点上我担心单一目录存储文件个数的问题.

  如下就是解决方法 让对应每个目录存储有限少量的文件 这样能够避免都堆在一个目录的问题.

  可用

cache.capacity=5000  
\# CACHE IN MEMORY  
cache.memory=true  
\# CACHE SIZE  
#cache.capacity=100  
\# CACHE PERSISTENCE CLASS  
cache.persistence.class=youclass\_package.MyDiskPersistenceListener  
\# CACHE DIRECTORY  
cache.path=d:/cache/

 

public class MyDiskPersistenceListener extends AbstractDiskPersistenceListener {  
    private static final String CHARS\_TO\_CONVERT = "./\\\\ :;\\"\\'\_?";  
       
    /\**  
    * Build cache file name for the specified cache entry key.  
    *  
    * @param key   Cache Entry Key.  
    * @return char\[] file name.  
    \*/  
    protected char\[] getCacheFileName(String key) {  
        if ((key == null) || (key.length() == 0)) {  
            throw new IllegalArgumentException("Invalid key '" + key + "' specified to getCacheFile.");  
        }

        char\[] chars = key.toCharArray();

        StringBuffer sb = new StringBuffer(chars.length + 18);

        for (int i = 0; i &lt; chars.length; i++) {  
            char c = chars\[i];  
            int pos = CHARS\_TO\_CONVERT.indexOf(c);  
   
            if (pos &gt;= 0) {  
                sb.append('\_');  
                sb.append(i);  
            } else {  
                sb.append(c);  
            }  
            if(i%3==2){  
                sb.append('/');  
            }  
        }

        char\[] fileChars = new char\[sb.length()];  
        sb.getChars(0, fileChars.length, fileChars, 0);  
        return fileChars;  
    }  
    public static void main(String str\[]){  
      System.out.println(new MyDiskPersistenceListener().getCacheFileName("12341dfkaklakasdfadklskadllkklasdf"));  
       
    }  
}