LightWeightCache extends LightWeightGSet<K, E> { public LightWeightCache(final int recommendedLength, final int sizeLimit, final long creationExpirationPeriod, final long accessExpirationPeriod) { this(recommendedLength, sizeLimit, creationExpirationPeriod, accessExpirationPeriod, new Timer()); } LightWeightCache(final int recommendedLength,
      final int sizeLimit,
      final long creationExpirationPeriod,
      final long accessExpirationPeriod); @VisibleForTesting  LightWeightCache(final int recommendedLength,
      final int sizeLimit,
      final long creationExpirationPeriod,
      final long accessExpirationPeriod,
      final Timer timer); @Override E get(K key); @Override E put(final E entry); E put(final E entry, long period); @Override E remove(K key); @Override Iterator<E> iterator();  }
@Test public void testLightWeightCache() { { final long creationExpiration = ran.nextInt(1024) + 1; check(1, creationExpiration, 0L, 1 << 10, 65537); check(17, creationExpiration, 0L, 1 << 16, 17); check(255, creationExpiration, 0L, 1 << 16, 65537); } for(int i = 0; i < 3; i++) { final long creationExpiration = ran.nextInt(1024) + 1; final long accessExpiration = ran.nextInt(1024) + 1; check(1, creationExpiration, accessExpiration, 1 << 10, 65537); check(17, creationExpiration, accessExpiration, 1 << 16, 17); check(255, creationExpiration, accessExpiration, 1 << 16, 65537); } final int dataSize = 1 << 16; for(int i = 0; i < 10; i++) { final int modulus = ran.nextInt(1024) + 1; final int sizeLimit = ran.nextInt(modulus) + 1; checkSizeLimit(sizeLimit, dataSize, modulus); } }