@Test public void testGetKeys() throws InterruptedException { int unpinCount = 500; int pinCount = 500; Set<Object> pinnedKeys = new HashSet<Object>(); Set<Object> removedPinnedKeys = new HashSet<Object>(); Set<Object> unpinnedKeys = new HashSet<Object>(); Object key = null; for (int i = 0; i < unpinCount; i++) { key = "Ku-" + i; unpinnedKeys.add(key); Element element = new Element(key, i); xaStore.put(element); } Thread.sleep(1000); Assert.assertEquals(unpinCount, xaStore.getSize()); for (int i = 0; i < pinCount; i++) { key = "Kp-" + i; pinnedKeys.add(key); Element element = new Element(key, i); xaStore.setPinned(element.getObjectKey(), true); xaStore.put(element); } Assert.assertEquals(pinCount+unpinCount, xaStore.getSize()); int halfPinned = pinCount/2; for (int i = 0; i < halfPinned; i++) { key = "Kp-" + i; removedPinnedKeys.add(key); xaStore.remove(key); } Thread.sleep(1000); pinnedKeys.removeAll(removedPinnedKeys); Assert.assertEquals(pinCount-halfPinned, pinnedKeys.size()); Assert.assertEquals(unpinCount+halfPinned, xaStore.getSize()); List keys = xaStore.getKeys(); Assert.assertEquals(unpinCount+halfPinned, xaStore.getSize()); Assert.assertEquals(unpinCount+halfPinned, keys.size()); for(Object okey : keys) { System.out.println(okey); Assert.assertFalse(removedPinnedKeys.contains(okey)); Assert.assertTrue(pinnedKeys.contains(okey) || unpinnedKeys.contains(okey)); } xaStore.removeAll(); keys = xaStore.getKeys(); Assert.assertEquals(0, xaStore.getSize()); Assert.assertEquals(0, keys.size()); }
public List getKeys() { return new ArrayList(keySet()); }
DiskStore extends AbstractStore implements TierableStore, PoolableStore, StripedReadWriteLockProvider { public List getKeys() { return new ArrayList(keySet()); } }
DiskStore extends AbstractStore implements TierableStore, PoolableStore, StripedReadWriteLockProvider { public List getKeys() { return new ArrayList(keySet()); } private  DiskStore(DiskStorageFactory disk, Ehcache cache, Pool onHeapPool, Pool onDiskPool); }
DiskStore extends AbstractStore implements TierableStore, PoolableStore, StripedReadWriteLockProvider { public List getKeys() { return new ArrayList(keySet()); } private  DiskStore(DiskStorageFactory disk, Ehcache cache, Pool onHeapPool, Pool onDiskPool); static DiskStore create(Ehcache cache, String diskStorePath, Pool onHeapPool, Pool onDiskPool); static DiskStore create(Cache cache, String diskStorePath); void unpinAll(); boolean isPinned(Object key); void setPinned(Object key, boolean pinned); static String generateUniqueDirectory(); boolean cleanUpFailedMarker(final Serializable key); StripedReadWriteLock createStripedReadWriteLock(); void changeDiskCapacity(int newCapacity); boolean bufferFull(); boolean containsKeyInMemory(Object key); boolean containsKeyOffHeap(Object key); boolean containsKeyOnDisk(Object key); void expireElements(); void flush(); Policy getInMemoryEvictionPolicy(); int getInMemorySize(); long getInMemorySizeInBytes(); int getOffHeapSize(); long getOffHeapSizeInBytes(); int getOnDiskSize(); long getOnDiskSizeInBytes(); int getTerracottaClusteredSize(); void setInMemoryEvictionPolicy(Policy policy); File getDataFile(); File getIndexFile(); Object getMBean(); void fill(Element e); boolean removeIfTierNotPinned(final Object key); boolean put(Element element); boolean putWithWriter(Element element, CacheWriterManager writerManager); Element get(Object key); Element getQuiet(Object key); Object unretrievedGet(Object key); boolean putRawIfAbsent(Object key, DiskMarker encoded); List getKeys(); Set<Object> keySet(); Element remove(Object key); void removeNoReturn(Object key); boolean isTierPinned(); Set getPresentPinnedKeys(); boolean isPersistent(); Element removeWithWriter(Object key, CacheWriterManager writerManager); void removeAll(); void dispose(); int getSize(); Status getStatus(); boolean evictFromOnHeap(int count, long size); boolean evictFromOnDisk(int count, long size); float getApproximateDiskHitRate(); float getApproximateDiskMissRate(); long getApproximateDiskCountSize(); long getApproximateDiskByteSize(); float getApproximateHeapHitRate(); float getApproximateHeapMissRate(); long getApproximateHeapCountSize(); long getApproximateHeapByteSize(); boolean containsKey(Object key); Object getInternalContext(); Element putIfAbsent(Element element); Element removeElement(Element element, ElementValueComparator comparator); boolean replace(Element old, Element element, ElementValueComparator comparator); Element replace(Element element); boolean fault(Object key, Placeholder expect, DiskMarker fault); boolean evict(Object key, DiskSubstitute substitute); Element evictElement(Object key, DiskSubstitute substitute); List<DiskStorageFactory.DiskSubstitute> getRandomSample(ElementSubstituteFilter factory, int sampleSize, Object keyHint); }
DiskStore extends AbstractStore implements TierableStore, PoolableStore, StripedReadWriteLockProvider { public List getKeys() { return new ArrayList(keySet()); } private  DiskStore(DiskStorageFactory disk, Ehcache cache, Pool onHeapPool, Pool onDiskPool); static DiskStore create(Ehcache cache, String diskStorePath, Pool onHeapPool, Pool onDiskPool); static DiskStore create(Cache cache, String diskStorePath); void unpinAll(); boolean isPinned(Object key); void setPinned(Object key, boolean pinned); static String generateUniqueDirectory(); boolean cleanUpFailedMarker(final Serializable key); StripedReadWriteLock createStripedReadWriteLock(); void changeDiskCapacity(int newCapacity); boolean bufferFull(); boolean containsKeyInMemory(Object key); boolean containsKeyOffHeap(Object key); boolean containsKeyOnDisk(Object key); void expireElements(); void flush(); Policy getInMemoryEvictionPolicy(); int getInMemorySize(); long getInMemorySizeInBytes(); int getOffHeapSize(); long getOffHeapSizeInBytes(); int getOnDiskSize(); long getOnDiskSizeInBytes(); int getTerracottaClusteredSize(); void setInMemoryEvictionPolicy(Policy policy); File getDataFile(); File getIndexFile(); Object getMBean(); void fill(Element e); boolean removeIfTierNotPinned(final Object key); boolean put(Element element); boolean putWithWriter(Element element, CacheWriterManager writerManager); Element get(Object key); Element getQuiet(Object key); Object unretrievedGet(Object key); boolean putRawIfAbsent(Object key, DiskMarker encoded); List getKeys(); Set<Object> keySet(); Element remove(Object key); void removeNoReturn(Object key); boolean isTierPinned(); Set getPresentPinnedKeys(); boolean isPersistent(); Element removeWithWriter(Object key, CacheWriterManager writerManager); void removeAll(); void dispose(); int getSize(); Status getStatus(); boolean evictFromOnHeap(int count, long size); boolean evictFromOnDisk(int count, long size); float getApproximateDiskHitRate(); float getApproximateDiskMissRate(); long getApproximateDiskCountSize(); long getApproximateDiskByteSize(); float getApproximateHeapHitRate(); float getApproximateHeapMissRate(); long getApproximateHeapCountSize(); long getApproximateHeapByteSize(); boolean containsKey(Object key); Object getInternalContext(); Element putIfAbsent(Element element); Element removeElement(Element element, ElementValueComparator comparator); boolean replace(Element old, Element element, ElementValueComparator comparator); Element replace(Element element); boolean fault(Object key, Placeholder expect, DiskMarker fault); boolean evict(Object key, DiskSubstitute substitute); Element evictElement(Object key, DiskSubstitute substitute); List<DiskStorageFactory.DiskSubstitute> getRandomSample(ElementSubstituteFilter factory, int sampleSize, Object keyHint); static final String AUTO_DISK_PATH_DIRECTORY_PREFIX; }