/** * This is used by the event logging. * <p> * @return the location of the disk, either path or ip. */ @Override protected String getDiskLocation() { return dataFile.getFilePath(); } }
/** * Returns the number of keys. * <p> * (non-Javadoc) * @see org.apache.commons.jcs.auxiliary.disk.AbstractDiskCache#getSize() */ @Override public int getSize() { return this.keyStore.size(); }
/** * Resets the keyfile, the disk file, and the memory key map. * <p> * @see org.apache.commons.jcs.auxiliary.disk.AbstractDiskCache#removeAll() */ @Override protected void processRemoveAll() { reset(); }
public void testObjectLargerThanMaxSize() { BlockDiskCacheAttributes attributes = new BlockDiskCacheAttributes(); attributes.setCacheName( "testObjectLargerThanMaxSize" ); attributes.setDiskPath( rootDirName ); attributes.setMaxKeySize( 1000 ); attributes.setBlockSizeBytes( 2000 ); attributes.setDiskLimitType(DiskLimitType.SIZE); @SuppressWarnings({ "unchecked", "rawtypes" }) BlockDiskKeyStore<String> keyStore = new BlockDiskKeyStore<String>( attributes, new BlockDiskCache(attributes)); keyStore.put("1", new int[1000]); keyStore.put("2", new int[1000]); assertNull(keyStore.get("1")); assertNotNull(keyStore.get("2")); } }
public void testPutKeysSize() throws Exception { // SETUP BlockDiskCacheAttributes attributes = new BlockDiskCacheAttributes(); attributes.setCacheName( "testPutKeys" ); attributes.setDiskPath( rootDirName ); attributes.setMaxKeySize( 100000 ); attributes.setBlockSizeBytes( 1024 ); attributes.setDiskLimitType(DiskLimitType.SIZE); innerTestPutKeys(attributes); }
public void testSaveLoadKeysSize() throws Exception { // SETUP BlockDiskCacheAttributes attributes = new BlockDiskCacheAttributes(); attributes.setCacheName("testSaveLoadKeys"); attributes.setDiskPath(rootDirName); attributes.setMaxKeySize(10000); attributes.setBlockSizeBytes(2000); testSaveLoadKeysInner(attributes); }
/** * Resets the file and creates a new key map. */ protected void reset() { synchronized (keyFile) { clearMemoryMap(); saveKeys(); } }
@Override public BlockDiskCacheAttributes getCacheAttributes() { BlockDiskCacheAttributes ret = new BlockDiskCacheAttributes(); ret.setDiskLimitType(DiskLimitType.SIZE); return ret; }
@Override public void runTest() throws Exception { this.runTestForRegion( "indexedRegion2" ); } } );
@Override public void runTest() throws Exception { this.runTestForRegion( "blockRegion4", 2000, 2200 ); } } );
@Override public void runTest() throws Exception { this.runTestForRegion( "blockRegion4", 2200, 5200 ); } } );
@Override public void runTest() throws Exception { this.runTestForRegion( "indexedRegion3" ); } } );
@Override public void runTest() throws Exception { this.runTestForRegion( "indexedRegion1" ); } } );
public void testObjectLargerThanMaxSize() { BlockDiskCacheAttributes attributes = new BlockDiskCacheAttributes(); attributes.setCacheName("testObjectLargerThanMaxSize"); attributes.setDiskPath(rootDirName); attributes.setMaxKeySize(1000); attributes.setBlockSizeBytes(2000); attributes.setDiskLimitType(DiskLimitType.SIZE); @SuppressWarnings({ "unchecked", "rawtypes" }) BlockDiskKeyStore<String> keyStore = new BlockDiskKeyStore<String>(attributes, new BlockDiskCache(attributes)); keyStore.put("1", new int[1000]); keyStore.put("2", new int[1000]); assertNull(keyStore.get("1")); assertNotNull(keyStore.get("2")); } }
public void testPutKeysSize() throws Exception { // SETUP BlockDiskCacheAttributes attributes = new BlockDiskCacheAttributes(); attributes.setCacheName("testPutKeys"); attributes.setDiskPath(rootDirName); attributes.setMaxKeySize(100000); attributes.setBlockSizeBytes(1024); attributes.setDiskLimitType(DiskLimitType.SIZE); innerTestPutKeys(attributes); }
public void testSaveLoadKeysSize() throws Exception { // SETUP BlockDiskCacheAttributes attributes = new BlockDiskCacheAttributes(); attributes.setCacheName( "testSaveLoadKeys" ); attributes.setDiskPath( rootDirName ); attributes.setMaxKeySize( 10000 ); attributes.setBlockSizeBytes( 2000 ); testSaveLoadKeysInner(attributes); }
@Override public BlockDiskCacheAttributes getCacheAttributes() { BlockDiskCacheAttributes ret = new BlockDiskCacheAttributes(); ret.setDiskLimitType(DiskLimitType.COUNT); return ret; }
@Override public void runTest() throws Exception { this.runTestForRegion( "indexedRegion2" ); } } );
@Override public void runTest() throws Exception { this.runTestForRegion( "blockRegion4", 2000, 2200 ); } } );
@Override public void runTest() throws Exception { this.runTestForRegion( "blockRegion4", 2200, 5200 ); } } );