hchar 2005/02/02 03:23:21
Modified: sandbox/yajcache/src/org/apache/jcs/yajcache/file
CacheFileUtils.java
Log:
add methods to support file cache
Revision Changes Path
1.4 +29 -1
jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/file/CacheFileUtils.java
Index: CacheFileUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-jcs/sandbox/yajcache/src/org/apache/jcs/yajcache/file/CacheFileUtils.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CacheFileUtils.java 29 Jan 2005 12:37:00 -0000 1.3
+++ CacheFileUtils.java 2 Feb 2005 11:23:21 -0000 1.4
@@ -18,6 +18,10 @@
package org.apache.jcs.yajcache.file;
import java.io.File;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
import org.apache.jcs.yajcache.config.YajCacheConfig;
import org.apache.jcs.yajcache.lang.annotation.*;
@@ -47,7 +51,7 @@
* Removes the file directory for the specified cache,
* including all files under the directory.
*/
- boolean rmCacheDir(@NonNullable String cacheName) {
+ public boolean rmCacheDir(@NonNullable String cacheName) {
File dir = this.getCacheDir(cacheName);
if (!dir.exists())
@@ -57,6 +61,30 @@
}
return dir.delete();
}
+ public boolean isCacheDirEmpty(@NonNullable String cacheName) {
+ File dir = this.getCacheDir(cacheName);
+
+ if (!dir.exists())
+ return true;
+ String[] list = dir.list();
+ return list == null || list.length == 0;
+ }
+ public int getCacheDirSize(@NonNullable String cacheName) {
+ File dir = this.getCacheDir(cacheName);
+
+ if (!dir.exists())
+ return 0;
+ String[] list = dir.list();
+ return list == null ? 0 : list.length;
+ }
+ public String[] getCacheDirList(@NonNullable String cacheName)
+ {
+ File dir = this.getCacheDir(cacheName);
+
+ if (!dir.exists())
+ return null;
+ return dir.list();
+ }
/**
* Returns the file directory for the specified cache.
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]