/** * @return cacheElement.getKey(); * @see ICacheElement#getKey */ @Override public K getKey() { return cacheElement.getKey(); }
/** * @return cacheElement.getKey(); * @see ICacheElement#getKey */ @Override public K getKey() { return cacheElement.getKey(); }
/** * Puts an item to the cache. * <p> * @param ce Description of the Parameter * @throws IOException */ @Override public void update( ICacheElement<K, V> ce ) throws IOException { putCnt.incrementAndGet(); map.put( ce.getKey(), new MemoryElementDescriptor<K, V>(ce) ); }
/** * Puts an item to the cache. * <p> * @param ce Description of the Parameter * @throws IOException */ @Override public void update( ICacheElement<K, V> ce ) throws IOException { putCnt++; map.put( ce.getKey(), new MemoryElementDescriptor<K, V>(ce) ); }
protected void doExpires(ICacheElement<K, V> element) { missCountExpired.incrementAndGet(); remove( element.getKey() ); }
/** * Log some details. * <p> * @param item */ private void logUpdateInfo( ICacheElement<K, V> item ) { if ( log.isInfoEnabled() ) { // not thread safe, but it doesn't have to be accurate puts++; if ( puts % logInterval == 0 ) { log.info( "puts = " + puts ); } } if ( log.isDebugEnabled() ) { log.debug( "In update, put [" + item.getKey() + "] in [" + item.getCacheName() + "]" ); } }
/** * Dump the cache entries from first to list for debugging. */ @SuppressWarnings("unchecked") // No generics for public fields public void dumpCacheEntries() { log.debug( "dumpingCacheEntries" ); for ( MemoryElementDescriptor<K, V> me = list.getFirst(); me != null; me = (MemoryElementDescriptor<K, V>) me.next ) { log.debug( "dumpCacheEntries> key=" + me.ce.getKey() + ", val=" + me.ce.getVal() ); } }
/** * Log some details. * <p> * @param item */ private void logUpdateInfo( ICacheElement<K, V> item ) { // not thread safe, but it doesn't have to be 100% accurate puts++; if ( log.isInfoEnabled() ) { if ( puts % logInterval == 0 ) { log.info( "puts = " + puts ); } } if ( log.isDebugEnabled() ) { log.debug( "In update, put [" + item.getKey() + "] in [" + item.getCacheName() + "]" ); } }
/** * Log some details. * <p> * @param item */ private void logUpdateInfo( ICacheElement<K, V> item ) { if ( log.isInfoEnabled() ) { // not thread safe, but it doesn't have to be accurate puts++; if ( puts % logInterval == 0 ) { log.info( "puts = " + puts ); } } if ( log.isDebugEnabled() ) { log.debug( "In update, put [" + item.getKey() + "] in [" + item.getCacheName() + "]" ); } }
/** * Log some details. * <p> * @param item */ private void logUpdateInfo( ICacheElement<K, V> item ) { // not thread safe, but it doesn't have to be 100% accurate puts++; if ( log.isInfoEnabled() ) { if ( puts % logInterval == 0 ) { log.info( "puts = " + puts ); } } if ( log.isDebugEnabled() ) { log.debug( "In update, put [" + item.getKey() + "] in [" + item.getCacheName() + "]" ); } }
/** * @param cacheElement * @throws IOException */ @Override protected void processUpdate( ICacheElement<K, V> cacheElement ) throws IOException { //System.out.println( "processUpdate: " + cacheElement ); map.put( cacheElement.getKey(), cacheElement ); }
/** * @param cacheElement * @throws IOException */ @Override protected void processUpdate( ICacheElement<K, V> cacheElement ) throws IOException { //System.out.println( "processUpdate: " + cacheElement ); map.put( cacheElement.getKey(), cacheElement ); }
/** * @param ce * @throws IOException */ @Override public void update( ICacheElement<K, V> ce ) throws IOException { if ( ce != null ) { map.put( ce.getKey(), ce ); } }
/** * @param ce * @throws IOException */ @Override public void update( ICacheElement<K, V> ce ) throws IOException { if ( ce != null ) { map.put( ce.getKey(), ce ); } }
@Override protected void doExpires(final ICacheElement<A, B> element) { super.doExpires(element); for (final JCSListener<A, B> listener : listeners.values()) { listener.onExpired(Arrays.<CacheEntryEvent<? extends A, ? extends B>> asList(new JCSCacheEntryEvent<A, B>( cacheRef, EventType.REMOVED, null, element.getKey(), element.getVal()))); } }
/** * Dump the cache entries from first to list for debugging. */ @SuppressWarnings("unchecked") // No generics for public fields private void dumpCacheEntries() { log.debug("dumpingCacheEntries"); for (MemoryElementDescriptor<K, V> me = list.getFirst(); me != null; me = (MemoryElementDescriptor<K, V>) me.next) { log.debug("dumpCacheEntries> key=" + me.getCacheElement().getKey() + ", val=" + me.getCacheElement().getVal()); } }
/** * Adds a new node to the start of the link list. * <p> * @param ce The feature to be added to the First * @return MemoryElementDescriptor */ protected MemoryElementDescriptor<K, V> addFirst( ICacheElement<K, V> ce ) { lock.lock(); try { MemoryElementDescriptor<K, V> me = new MemoryElementDescriptor<K, V>(ce); list.addFirst(me); verifyCache(ce.getKey()); return me; } finally { lock.unlock(); } }
/** * Adds a new node to the end of the link list. * <p> * @param ce The feature to be added to the First * @return MemoryElementDescriptor */ protected MemoryElementDescriptor<K, V> addLast( ICacheElement<K, V> ce ) { lock.lock(); try { MemoryElementDescriptor<K, V> me = new MemoryElementDescriptor<K, V>(ce); list.addLast(me); verifyCache(ce.getKey()); return me; } finally { lock.unlock(); } }
/** * Constructor for the PurgatoryElement<K, V> object * * @param cacheElement CacheElement */ public PurgatoryElement( ICacheElement<K, V> cacheElement ) { super(cacheElement.getCacheName(), cacheElement.getKey(), cacheElement.getVal(), cacheElement.getElementAttributes()); this.cacheElement = cacheElement; }
/** * Constructor for the PurgatoryElement<K, V> object * <p> * @param cacheElement CacheElement */ public PurgatoryElement( ICacheElement<K, V> cacheElement ) { super(cacheElement.getCacheName(), cacheElement.getKey(), cacheElement.getVal(), cacheElement.getElementAttributes()); this.cacheElement = cacheElement; }