We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
`
//private static Map<String, ACache> mInstanceMap = Collections.synchronizedMap(new HashMap<String, ACache>()); private static ACache instance = null;
/** * 个人觉得没必要用map来缓存实例,一个就够用了 * @param cacheDir * @param max_zise * @param max_count * @return */ public static ACache get(File cacheDir, long max_zise, int max_count) { if (instance == null) { synchronized (ACache.class) { //ACache manager = mInstanceMap.get(cacheDir.getAbsoluteFile() + myPid()); if (instance == null) { instance = new ACache(cacheDir, max_zise, max_count); //mInstanceMap.put(cacheDir.getAbsolutePath() + myPid(), manager); } } } return instance; }
/** * hashCode发生碰撞怎么办,我建议用base64 * @param key * @return */ private File newFile(String key) { //return new File(cacheDir, key.hashCode() + ""); return new File(cacheDir, Base64.encodeToString(key.getBytes(), Base64.NO_WRAP) + ""); }
` 我改过的版本在这里: https://github.com/moz1q1/WalleLibrary/tree/master/library_utils/src/main/java/org/wall/mo/utils/cache 你都不合并人家代码,我只能这样改了
The text was updated successfully, but these errors were encountered:
你这么改,全局只有一个Acahe,那么cacheDir就无法修改了。会产生三个问题 1、用户自定义存储的目录失效 2、只存在一个目录,一旦存储内容多,50m上限达到,容易造成文件频繁删除 3、lastUsageDates的map初次缓存特别大,对于内存属于浪费
Sorry, something went wrong.
No branches or pull requests
`
//private static Map<String, ACache> mInstanceMap = Collections.synchronizedMap(new
HashMap<String, ACache>());
private static ACache instance = null;
`
我改过的版本在这里:
https://github.com/moz1q1/WalleLibrary/tree/master/library_utils/src/main/java/org/wall/mo/utils/cache
你都不合并人家代码,我只能这样改了
The text was updated successfully, but these errors were encountered: