11package cacheProcessor ;
22import java .util .*;
3+ //refer javadoc-api/org/springframework/cache/CacheManager.html 这是spring 早期的缓存函数进行了2次修改。
4+ //修改人 罗瑶光
35public class CacheManager {
46@ SuppressWarnings ("rawtypes" )
57private static HashMap cacheMap =new HashMap ();
68
79private CacheManager () {
810super ();
911}
10-
1112@ SuppressWarnings ("unchecked" )
1213public synchronized static boolean setSimpleFlag (String key ,long serverbegrundt ) {
1314if (cacheMap .get (key ) ==null ) {
@@ -17,22 +18,17 @@ public synchronized static boolean setSimpleFlag(String key, long serverbegrundt
1718return false ;
1819}
1920}
20-
21-
2221//private synchronized static Cache getCache(String key) {
2322private synchronized static Cache getCache (String key ) {
2423return (Cache )cacheMap .get (key );
2524}
26-
2725// private synchronized static boolean hasCache(String key) {
2826private synchronized static boolean hasCache (String key ) {
2927return cacheMap .containsKey (key );
3028}
31-
3229public synchronized static void clearAll () {
3330cacheMap .clear ();
3431}
35-
3632@ SuppressWarnings ({"rawtypes" ,"unchecked" })
3733public synchronized static void clearAll (String type ) {
3834Iterator i =cacheMap .entrySet ().iterator ();
@@ -53,17 +49,14 @@ public synchronized static void clearAll(String type) {
5349ex .printStackTrace ();
5450}
5551}
56-
5752public synchronized static void clearOnly (String key ) {
5853cacheMap .remove (key );
5954}
60-
6155//public synchronized static void putCache(String key, Cache obj) {
6256@ SuppressWarnings ("unchecked" )
6357public synchronized static void putCache (String key ,Cache obj ) {
6458cacheMap .put (key ,obj );
6559}
66-
6760public synchronized static Cache getCacheInfo (String key ) {
6861if (hasCache (key )) {
6962Cache cache =getCache (key );
@@ -74,7 +67,6 @@ public synchronized static Cache getCacheInfo(String key) {
7467}else
7568return null ;
7669}
77-
7870@ SuppressWarnings ("unchecked" )
7971public static void putCacheInfo (String key ,Cache obj ,long dt ,boolean expired ) {
8072Cache cache =new Cache ();
@@ -84,7 +76,6 @@ public static void putCacheInfo(String key, Cache obj, long dt, boolean expired)
8476cache .setExpired (expired );
8577cacheMap .put (key ,cache );
8678}
87-
8879@ SuppressWarnings ("unchecked" )
8980public static void putCacheInfo (String key ,Cache obj ,long dt ) {
9081Cache cache =new Cache ();
@@ -94,7 +85,6 @@ public static void putCacheInfo(String key, Cache obj, long dt) {
9485cache .setExpired (false );
9586cacheMap .put (key ,cache );
9687}
97-
9888public static boolean cacheExpired (Cache cache ) {
9989if (null ==cache ) {
10090return false ;
@@ -107,11 +97,9 @@ public static boolean cacheExpired(Cache cache) {
10797return true ;
10898}
10999}
110-
111100public synchronized static int getCacheSize () {
112101return cacheMap .size ();
113102}
114-
115103@ SuppressWarnings ("rawtypes" )
116104public static int getCacheSize (String type ) {
117105int k =0 ;
@@ -145,7 +133,6 @@ public static ArrayList getCacheAllkey() {
145133return a ;
146134}
147135}
148-
149136@ SuppressWarnings ({"rawtypes" ,"unchecked" ,"finally" })
150137public static ArrayList getCacheListkey (String type ) {
151138ArrayList a =new ArrayList ();